From a6c833b3ec5202ecc22ce6feba36b55defeca604 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Wed, 21 Jul 2021 18:34:35 +0200 Subject: [PATCH] Fix episodi Toonitalia --- channels/toonitalia.py | 20 +++++++++----------- core/support.py | 14 +++++++------- lib/proxytranslate.py | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/channels/toonitalia.py b/channels/toonitalia.py index 69ebb1e6..2a16dae9 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -93,17 +93,15 @@ def peliculas(item): @support.scrape def episodios(item): anime = True - def get_ep(item): - find = '' - data = support.match(item, headers=headers).data - match = support.match(data, patron=r'(?: /> |

)(?:(?P\d+)×)?(?P\d+)(?:\s+–\s+)?(?P[^<]+)<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 - - data = get_ep(item) - patron = r'(?P<episode>[^|]+)\|(?P<title>[^|]+)\|(?P<data>[^|]+)\|' + # debug = True + patron = r'>\s*(?:(?P<season>\d+)(?:×|x|×))?(?P<episode>\d+)(?:\s+–\s+)?[ –]+(?P<title2>[^<]+)[ –]+<a (?P<data>.*?)(?:<br|</p)' + # data = '' + # match = support.match(item, headers=headers, 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: + # data += '{}{:02d}|{}|{}|'.format(m[0]+'x' if m[0] else '', int(m[1]), clean_title(m[2]), m[3]) + # + # patron = r'(?P<episode>[^|]+)\|(?P<title>[^|]+)\|(?P<data>[^|]+)\|' return locals() diff --git a/core/support.py b/core/support.py index 7647fb82..d1ef244d 100755 --- a/core/support.py +++ b/core/support.py @@ -552,13 +552,13 @@ def scrape(func): if patronNext and inspect.stack()[1][3] not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']: nextPage(itemlist, item, data, patronNext, function) - for it in itemlist: - if it.contentEpisodeNumber and it.contentSeason: - it.title = '[B]{:d}x{:02d} - {}[/B]'.format(it.contentSeason, it.contentEpisodeNumber, it.infoLabels['title'] if it.infoLabels['title'] else it.fulltitle) - if it.contentLanguage: - it.title += typo(it.contentLanguage, '_ [] color kod') - if it.quality: - it.title += typo(it.quality, '_ [] color kod') + # for it in itemlist: + # if it.contentEpisodeNumber and it.contentSeason: + # it.title = '[B]{:d}x{:02d} - {}[/B]'.format(it.contentSeason, it.contentEpisodeNumber, it.infoLabels['title'] if it.infoLabels['title'] else it.fulltitle) + # if it.contentLanguage: + # it.title += typo(it.contentLanguage, '_ [] color kod') + # if it.quality: + # it.title += typo(it.quality, '_ [] color kod') # next page for pagination if pagination and len(matches) > pag * pagination and not search: diff --git a/lib/proxytranslate.py b/lib/proxytranslate.py index 4949430a..47be03b9 100644 --- a/lib/proxytranslate.py +++ b/lib/proxytranslate.py @@ -97,7 +97,7 @@ def process_request_proxy(url): data = re.sub('\s(\w+)=(?!")([^<>\s]+)', r' \1="\2"', data) data = re.sub('https://translate\.googleusercontent\.com/.*?u=(.*?)&usg=[A-Za-z0-9_-]+', '\\1', data) - data = re.sub('https?://[a-zA-Z0-9-]+' + domain.replace('.', '-') + '\.translate\.goog(/[a-zA-Z0-9#/-]+)', 'https://' + domain + '\\1', data) + data = re.sub('https?://[a-zA-Z0-9-]*' + domain.replace('.', '-') + '\.translate\.goog(/[a-zA-Z0-9#/-]+)', 'https://' + domain + '\\1', data) data = re.sub('\s+<', '<', data) data = data.replace('&', '&').replace('https://translate.google.com/website?sl=' + SL + '&tl=' + TL + '&ajax=1&u=', '')