KoD 0.5.1
-override DNS di default -nuovi canali: streamtime e netfreex -fixato cloudflare -aggiunta opzione apri nel browser
This commit is contained in:
+94
-59
@@ -3,6 +3,12 @@ from core import support, httptools, scrapertoolsV2
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
|
||||
|
||||
"""
|
||||
Nota per i tester: questo non è un canale 'tradizionale', essendo un canale telegram, i cui contenuti (film/serie) sono mischiati tra loro (ed a volte ci sono messaggi sponsor),
|
||||
la lista delle pagine non sarà affatto 'uniforme' (a seconda di come viene presentata la preview)
|
||||
"""
|
||||
|
||||
__channel__ = "streamtime"
|
||||
host = config.get_channel_url(__channel__)
|
||||
headers = [['Referer', 'org.telegram.messenger']]
|
||||
@@ -20,47 +26,45 @@ def mainlist(item):
|
||||
|
||||
@support.scrape
|
||||
def peliculas(item):
|
||||
patron = """tgme_widget_message_photo_wrap blured.*?image:url\("(?P<thumbnail>[^"]+).*?(?:🎥|🎬)(?P<title>.*?)(?:🎥|🎬).*?(?:Audio(?:</b>)?: (?P<lang>.*?<br>))?.*?Anno(?:</b>)?: (?P<year>[0-9]{4}).*?(?:<b>Stream</b>|Risoluzione|<b>Tipo</b>): (?P<quality>[^<]+).*?tgme_widget_message_inline_button url_button" href="(?P<url>[^"]+)"""
|
||||
patron = """tgme_widget_message_photo_wrap.*?image:url\("(?P<thumbnail>[^"]+).*?//telegram\.org/img/emoji/40/(?:F09F8EAC|F09F8EA5)\.png"\)">.*?</i>\s?(?:<b>)?(?P<title>[^<]+).*?(?:Audio(?:</b>)?: (?P<lang>.*?<br>))?.*?Anno(?:</b>)?: (?P<year>[0-9]{4}).*?(?:<b>Stream</b>|Risoluzione|<b>Tipo</b>|Tipo|Stream): (?P<quality>[^<]+).*?tgme_widget_message_inline_button url_button" href="(?P<url>[^"]+)"""
|
||||
def itemlistHook(itemlist):
|
||||
retItemlist = []
|
||||
# filtro per tipo
|
||||
for i in itemlist:
|
||||
if item.contentType == 'movie':
|
||||
if '/Film/' in i.url or 'Stream-' in i.url:
|
||||
retItemlist.append(i)
|
||||
else:
|
||||
if '/SerieTv/' in i.url:
|
||||
retItemlist.append(i)
|
||||
if '/Film/' in i.url or 'Stream-' in i.url:
|
||||
i.contentType = 'movie'
|
||||
if '/SerieTv/' in i.url:
|
||||
i.contentType = 'tvshow'
|
||||
i.action = 'episodios'
|
||||
if item.contentType == i.contentType or item.contentType == 'list': # list = ricerca globale quando c'è un solo tipo di risultato
|
||||
retItemlist.append(i)
|
||||
# rimuovo duplicati
|
||||
if item.contentType != 'movie':
|
||||
if item.contentType != 'movie' and not item.cercaSerie:
|
||||
nonDupl = []
|
||||
# support.dbg()
|
||||
for i in retItemlist:
|
||||
for nd in nonDupl:
|
||||
if i.title == nd.title:
|
||||
if i.fulltitle == nd.fulltitle:
|
||||
break
|
||||
else:
|
||||
daAgg = i
|
||||
spl1 = i.url.split('-')
|
||||
stagione1 = spl1[-2]
|
||||
nEp1 = int(spl1[-1])
|
||||
|
||||
for i2 in retItemlist[1:]:
|
||||
if i.title == i2.title:
|
||||
spl2 = i2.url.split('-')
|
||||
stagione2 = spl2[-2]
|
||||
nEp2 = int(spl2[-1])
|
||||
if stagione1 == stagione2 and nEp2 > nEp1:
|
||||
daAgg = i2
|
||||
nonDupl.append(daAgg)
|
||||
nonDupl.append(i)
|
||||
retItemlist = nonDupl
|
||||
return retItemlist[::-1]
|
||||
# debug = True
|
||||
patronNext = 'tgme_widget_message_photo_wrap blured" href="([^"]+)'
|
||||
def fullItemlistHook(itemlist):
|
||||
msgId = int(itemlist[-1].url.split('/')[-1])
|
||||
itemlist[-1].url = host + '?before=' + str(msgId) + '&after=' + str(msgId-20)
|
||||
return itemlist
|
||||
# nella ricerca faccio finta che non ci siano "pagine successive", sarebbe un casino gestirle (ed è piuttosto improbabile)
|
||||
if item.action != 'search' and item.action:
|
||||
patronNext = 'tgme_widget_message_photo_wrap blured" href="([^"]+)'
|
||||
|
||||
# trovo l'id dell'ultimo messaggio e nella pagina successiva ci metto il link per prendere i 20 msg precedenti
|
||||
def fullItemlistHook(itemlist):
|
||||
msgId = int(itemlist[-1].url.split('/')[-1])
|
||||
itemlist[-1].url = host + '?before=' + str(msgId) + '&after=' + str(msgId-20)
|
||||
return itemlist
|
||||
|
||||
# necessario per togliere html vario dal titolo (operazione fatta solo su fulltitle)
|
||||
# def itemHook(item):
|
||||
# item.contentTitle = item.fulltitle
|
||||
# item.show = item.fulltitle
|
||||
# return item
|
||||
|
||||
if item.contentType == 'tvshow':
|
||||
action = 'episodios'
|
||||
@@ -79,29 +83,64 @@ def search(item, texto):
|
||||
return []
|
||||
|
||||
|
||||
def newest(categoria):
|
||||
item = Item()
|
||||
if categoria == "series":
|
||||
item.contentType = 'tvshow'
|
||||
item.url = host + '?q=%23SerieTv'
|
||||
else:
|
||||
item.contentType = 'movie'
|
||||
item.url = host + '?q=%23Film'
|
||||
return peliculas(item)
|
||||
|
||||
|
||||
# cerco il titolo, così mi escono fuori tutti i messaggi contenenti puntate singole o serie
|
||||
def episodios(item):
|
||||
domain, id, season, episode = scrapertoolsV2.find_single_match(item.url, r'(https?://[a-z0-9.-]+).*?/([^-/]+)-S([0-9]+)-([0-9]+)$')
|
||||
url = item.url
|
||||
item.cercaSerie = True
|
||||
itemlist = search(item, item.fulltitle.replace("'", ""))
|
||||
stagioni = {}
|
||||
|
||||
for i in itemlist[:-1]:
|
||||
spl1 = i.url.split('-')
|
||||
if len(spl1) > 3:
|
||||
st = spl1[1] + '-' + spl1[2]
|
||||
else:
|
||||
st = spl1[-2]
|
||||
nEp = int(spl1[-1])
|
||||
if st not in stagioni.keys():
|
||||
stagioni[st] = nEp
|
||||
elif nEp > stagioni[st]:
|
||||
stagioni[st] = nEp
|
||||
|
||||
itemlist = []
|
||||
for n in range(1, int(episode)):
|
||||
url = domain + '/play_s.php?s=' + id + '-S' + season + '&e=' + str(n)
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
action="findvideos",
|
||||
title=str(int(season)) + 'x' + str(n) + support.typo(item.quality, '-- [] color kod'),
|
||||
url=url,
|
||||
fulltitle=item.fulltitle,
|
||||
thumbnail=item.thumbnail,
|
||||
show=item.show,
|
||||
quality=item.quality,
|
||||
contentType=item.contentType,
|
||||
folder=False,
|
||||
args={'id': id, 'season': season, 'episode': episode}))
|
||||
domain, id = scrapertoolsV2.find_single_match(url, r'(https?://[a-z0-9.-]+)/[^/]+/([^-/]+)')
|
||||
for st in sorted(stagioni.keys()):
|
||||
season = st[1:]
|
||||
episode = stagioni[st]
|
||||
for n in range(1, int(episode)):
|
||||
url = domain + '/play_s.php?s=' + id + '-S' + season + '&e=' + str(n)
|
||||
if '-' in season: # vedi https://stpgs.ml/SerieTv/Atypical-S01-8-8.html
|
||||
season = season.split('-')[0]
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
action="findvideos",
|
||||
title=str(int(season)) + 'x' + str(n) + support.typo(item.quality, '-- [] color kod'),
|
||||
url=url,
|
||||
fulltitle=item.fulltitle,
|
||||
thumbnail=item.thumbnail,
|
||||
show=item.show,
|
||||
quality=item.quality,
|
||||
contentType='episode',
|
||||
folder=True,
|
||||
args={'id': id, 'season': season, 'episode': episode}))
|
||||
|
||||
support.videolibrary(itemlist, item)
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
# support.dbg()
|
||||
domain = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+')
|
||||
if item.contentType == 'movie':
|
||||
id = item.url.split('/')[-1]
|
||||
@@ -109,33 +148,29 @@ def findvideos(item):
|
||||
else:
|
||||
url = item.url
|
||||
id = item.args['id']
|
||||
season = item.args['season']
|
||||
episode = item.args['episode']
|
||||
res = support.match(item, 'src="([^"]+)">.*?</video>', url=url, headers=[['Referer', domain]])
|
||||
season = str(item.args['season'])
|
||||
episode = str(item.args['episode'])
|
||||
res = support.match(item, 'src="([^"]+)"[^>]*></video>', url=url, headers=[['Referer', domain]])
|
||||
itemlist = []
|
||||
support.dbg()
|
||||
|
||||
if res[0]:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
action="play",
|
||||
title='stpgs.ml' + support.typo(item.quality, '-- [] color kod'),
|
||||
title='contentful',
|
||||
url=res[0][0],
|
||||
server='directo',
|
||||
fulltitle=item.fulltitle,
|
||||
thumbnail=item.thumbnail,
|
||||
show=item.show,
|
||||
quality=item.quality,
|
||||
contentType=item.contentType,
|
||||
folder=False))
|
||||
download = itemlist[0].clone()
|
||||
if item.contentType == 'movie':
|
||||
download.url = downPrefix + id
|
||||
else:
|
||||
download.url = downPrefix + id + 'S' + season + '-' + episode
|
||||
itemlist.append(download)
|
||||
contentType=item.contentType))
|
||||
# download = itemlist[0].clone()
|
||||
# if item.contentType == 'movie':
|
||||
# download.url = downPrefix + id
|
||||
# else:
|
||||
# download.url = downPrefix + id + '-S' + season + '-' + episode
|
||||
# itemlist.append(download)
|
||||
else:
|
||||
# google drive...
|
||||
pass
|
||||
support.videolibrary(itemlist, item)
|
||||
return support.controls(itemlist, item, True, True)
|
||||
return support.server(item, itemlist=itemlist)
|
||||
|
||||
Reference in New Issue
Block a user