diff --git a/channels.json b/channels.json index d0f9839b..af78f550 100644 --- a/channels.json +++ b/channels.json @@ -40,7 +40,7 @@ "streamtime": "https://t.me/s/StreamTime", "tantifilm": "https://www.tantifilm.vision", "tapmovie": "https://it.tapmovie.net", - "toonitalia": "https://toonitalia.pro", + "toonitalia": "https://toonitalia.co", "vvvvid": "https://www.vvvvid.it" }, "findhost": { diff --git a/channels/animeunity.py b/channels/animeunity.py index 5097cd4c..bde40045 100644 --- a/channels/animeunity.py +++ b/channels/animeunity.py @@ -3,6 +3,7 @@ # Canale per AnimeUnity # ------------------------------------------------------------ +from lib.requests.sessions import session import requests, json, copy, inspect from core import support from platformcode import autorenumber @@ -115,8 +116,10 @@ def news(item): support.info() item.contentType = 'episode' itemlist = [] + import cloudscraper + session = cloudscraper.create_scraper() - fullJs = json.loads(support.match(item, headers=headers, patron=r'items-json="([^"]+)"').match.replace('"','"')) + fullJs = json.loads(support.match(session.get(item.url).text, headers=headers, patron=r'items-json="([^"]+)"', debug=True).match.replace('"','"')) js = fullJs['data'] for it in js: diff --git a/channels/hd4me.py b/channels/hd4me.py index a01174bc..a5b49b4e 100644 --- a/channels/hd4me.py +++ b/channels/hd4me.py @@ -26,7 +26,7 @@ def peliculas(item): patron = r']*>){2}\s*(?P[^<]+)</a>[^>]+>[^>]+>[^>]+><img.*?src="(?P<thumb>[^"]+)".*?<p>(?P<plot>[^<]+)</p>.*?<span class="cat-links">Pubblicato in.*?.*?(?P<type>(?:[Ff]ilm|</artic))[^>]+>' - patron = r'<a href="(?P<url>[^"]+)"[^>]+>(?P<title>[^<]+)</a>[^>]+>[^>]+>[^>]+><img.*?src="(?P<thumb>[^"]+)".*?<p>(?P<plot>[^<]+)</p>.*?tag">.*?(?P<type>(?:[Ff]ilm|</art|Serie Tv))' + patron = r'<a href="(?P<url>[^"]+)" rel="bookmark">(?P<title>[^<]+)</a>(:?[^>]+>){3}(?:<img.*?src="(?P<thumb>[^"]+)")?.*?<p>(?P<plot>[^<]+)</p>.*?tag">.*?(?P<type>(?:[Ff]ilm|</art|Serie Tv))' typeContentDict={'movie':['film']} typeActionDict={'findvideos':['film']} patronNext = '<a class="next page-numbers" href="([^"]+)">' @@ -93,21 +93,27 @@ def peliculas(item): @support.scrape def episodios(item): anime = True - data = support.match(item, headers=headers).data - if 'https://vcrypt.net' in data: - patron = r'(?: /> |<p>)(?P<episode>\d+.\d+)?(?: – )?(?P<title>[^<]+)<a (?P<data>.*?)(?:<br|</p)' - else: - patron = r'<br />\s*<a href="(?P<url>[^"]+)" target="_blank" rel="noopener[^>]+>(?P<episode>\d+.\d+)?(?: – )?(?P<title>[^<]+)</a>' + def get_ep(item): + find = '' + data = support.match(item, headers=headers).data + match = support.match(data, patron=r'(?: /> |<p>)(?:(?P<season>\d+)×)?(?P<episode>\d+)(?:\s+–\s+)?(?P<title>[^<]+)<a (?P<data>.*?)(?:<br|</p)').matches + if match: + for m in match: + find += '{}{:02d}|{}|{}|'.format(m[0]+'x' if m[0] else '', int(m[1]), clean_title(m[2]), m[3]) + return find - def itemHook(item): - item.title = support.re.sub(r'\[B\]|\[/B\]', '', item.title) - item.title = item.title.replace('_',' ').replace('–','-').replace('×','x').replace('-','-').replace(' ',' ') - item.title = support.re.sub(item.fulltitle + ' - ','',item.title) - item.title = support.typo(item.title.strip(' -'),'bold') - return item + data = get_ep(item) + patron = r'(?P<episode>[^|]+)\|(?P<title>[^|]+)\|(?P<data>[^|]+)\|' return locals() def findvideos(item): return support.server(item, item.data if item.contentType != 'movie' else support.match(item.url, headers=headers).data ) + + +def clean_title(title): + title = scrapertools.unescape(title) + title = title.replace('_',' ').replace('–','-').replace(' ',' ') + title = title.strip(' - ') + return title \ No newline at end of file