Files
addon/channels/bleachportal.py
marco aea652c703 KoD 0.5
-Ridefinito il modo in cui vengono scritti i canali, per assicurare migliore stabilità, debuggabilità e coerenza
-Riscritti di conseguenza molti canali, corregendo di fatto moltissimi problemi che avete segnalato
-Quando aggiungi in videoteca da fonti in più lingue (ita/sub ita) o più qualità, ti viene chiesto quale tipo di fonte vuoi.
-Per gli amanti degli anime, aggiunto VVVVID (senza bisogno di account!)
-Aggiunti i server supervideo e hdload, fixato wstream
-migliorie varie
2019-11-07 19:10:53 +01:00

120 lines
4.7 KiB
Python

# -*- coding: utf-8 -*-
# Ringraziamo Icarus crew
# ------------------------------------------------------------
# XBMC Plugin
# Canale per http://bleachportal.it
# ------------------------------------------------------------
import re
from core import scrapertools, httptools
from core.item import Item
from platformcode import logger
from platformcode import config
from core import support
host = "http://www.bleachportal.it"
def mainlist(item):
logger.info("[BleachPortal.py]==> mainlist")
itemlist = [Item(channel=item.channel,
action="episodi",
title= support.typo('Bleach','bold'),
url=host + "/streaming/bleach/stream_bleach.htm",
thumbnail="https://www.thetvdb.com/banners/posters/74796-14.jpg",
banner="https://www.thetvdb.com/banners/graphical/74796-g6.jpg",
fanart="https://www.thetvdb.com/banners/fanart/original/74796-30.jpg",
extra="bleach"),
Item(channel=item.channel,
action="episodi",
title=support.typo('D.Gray Man','bold'),
url=host + "/streaming/d.gray-man/stream_dgray-man.htm",
thumbnail="https://www.thetvdb.com/banners/posters/79635-1.jpg",
banner="https://www.thetvdb.com/banners/graphical/79635-g4.jpg",
fanart="https://www.thetvdb.com/banners/fanart/original/79635-6.jpg",
extra="dgrayman")]
return itemlist
def episodi(item):
logger.info("[BleachPortal.py]==> episodi")
itemlist = []
data = httptools.downloadpage(item.url).data
patron = r'<td>?[<span\s|<width="\d+%"\s]+?class="[^"]+">\D+([\d\-]+)\s?<[^<]+<[^<]+<[^<]+<[^<]+<.*?\s+?.*?<span style="[^"]+">([^<]+).*?\s?.*?<a href="\.*(/?[^"]+)">'
matches = re.compile(patron, re.DOTALL).findall(data)
animetitle = "Bleach" if item.extra == "bleach" else "D.Gray Man"
for scrapednumber, scrapedtitle, scrapedurl in matches:
scrapedtitle = scrapedtitle.decode('latin1').encode('utf8')
itemlist.append(
Item(channel=item.channel,
action="findvideos",
title=support.typo("%s Episodio %s" % (animetitle, scrapednumber),'bold'),
url=item.url.replace("stream_bleach.htm",scrapedurl) if "stream_bleach.htm" in item.url else item.url.replace("stream_dgray-man.htm", scrapedurl),
plot=scrapedtitle,
extra=item.extra,
thumbnail=item.thumbnail,
fanart=item.fanart,
fulltitle="%s Ep: %s | %s" % (animetitle, scrapednumber, scrapedtitle)))
if item.extra == "bleach":
itemlist.append(
Item(channel=item.channel,
action="oav",
title=support.typo("OAV e Movies",'bold color kod'),
url=item.url.replace("stream_bleach.htm", "stream_bleach_movie_oav.htm"),
extra=item.extra,
thumbnail=item.thumbnail,
fanart=item.fanart))
return list(reversed(itemlist))
def oav(item):
logger.info("[BleachPortal.py]==> oav")
itemlist = []
data = httptools.downloadpage(item.url).data
patron = r'<td>?[<span\s|<width="\d+%"\s]+?class="[^"]+">-\s+(.*?)<[^<]+<[^<]+<[^<]+<[^<]+<.*?\s+?.*?<span style="[^"]+">([^<]+).*?\s?.*?<a href="\.*(/?[^"]+)">'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapednumber, scrapedtitle, scrapedurl in matches:
itemlist.append(
Item(channel=item.channel,
action="findvideos",
title=support.typo(scrapednumber, 'bold'),
url=item.url.replace("stream_bleach_movie_oav.htm", scrapedurl),
plot=scrapedtitle,
extra=item.extra,
thumbnail=item.thumbnail,
fulltitle=scrapednumber + " | " + scrapedtitle))
return list(reversed(itemlist))
def findvideos(item):
logger.info("[BleachPortal.py]==> findvideos")
itemlist = []
if "bleach//" in item.url:
item.url = re.sub(r'\w+//', "", item.url)
data = httptools.downloadpage(item.url).data
if "bleach" in item.extra:
video = scrapertools.find_single_match(data, 'file: "(.*?)",')
else:
video = scrapertools.find_single_match(data, 'file=(.*?)&').rsplit('/', 1)[-1]
itemlist.append(
Item(channel=item.channel,
action="play",
title="Diretto %s" % item.title,
url=item.url.replace(item.url.split("/")[-1], "/" + video),
thumbnail=item.thumbnail,
fulltitle=item.fulltitle))
return itemlist