diff --git a/channels.json b/channels.json index 2b3473ab..d3dc65dd 100644 --- a/channels.json +++ b/channels.json @@ -3,14 +3,14 @@ "altadefinizione01_link": "https://altadefinizione01.baby", "altadefinizioneclick": "https://altadefinizione.productions", "animeforce": "https://ww1.animeforce.org", - "animeleggendari": "https://animepertutti.org", + "animeleggendari": "https://animeora.com", "animesaturn": "https://www.animesaturn.com", "animestream": "https://www.animeworld.it", "animesubita": "http://www.animesubita.org", "animetubeita": "http://www.animetubeita.com", "animeunity": "https://www.animeunity.it", "animeworld": "https://www.animeworld.tv", - "casacinema": "https://www.casacinema.pw", + "casacinema": "https://www.casacinema.rest", "casacinemaInfo": "https://casacinema.life", "cb01anime": "https://www.cineblog01.red/", "cinemalibero": "https://cinemalibero.plus", diff --git a/channels/altadefinizione01_link.py b/channels/altadefinizione01_link.py index ebd69e34..1005856e 100644 --- a/channels/altadefinizione01_link.py +++ b/channels/altadefinizione01_link.py @@ -34,10 +34,11 @@ def mainlist(item): @support.scrape def peliculas(item): + # debug = True support.log('peliculas',item) - patron = r'(?P[^<]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*<div class="[^"]+" style="background-image:url\((?P<thumb>[^\)]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+> (?P<duration>\d+)[^>]+>[^>]+> (?P<quality>[a-zA-Z]+) [^>]+>[^>]+> (?P<lang>[^>]+) [^>]+>' - patronNext = r'<span>\d</span> <a href="([^"]+)">' + patron = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*<div class="[^"]+" style="background-image:url\((?P<thumb>[^\)]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+>(?:\s*(?P<duration>\d+)[^>]+>[^>]+>)?\s*(?P<quality>[a-zA-Z]+) [^>]+>[^>]+> (?P<lang>[^>]+) [^>]+>' + patronNext = r'<span>\d</span> <a href="([^"]+)">' # debug = True return locals() diff --git a/channels/animeunity.py b/channels/animeunity.py index ba614d7b..dc3aa044 100644 --- a/channels/animeunity.py +++ b/channels/animeunity.py @@ -6,10 +6,6 @@ from core import support host = support.config.get_channel_url() - - - - headers = [['Referer', host]] diff --git a/channels/casacinema.py b/channels/casacinema.py index c8a4fc30..db9d283c 100644 --- a/channels/casacinema.py +++ b/channels/casacinema.py @@ -11,8 +11,6 @@ host = support.config.get_channel_url() headers = [['Referer', host]] - - @support.menu def mainlist(item): film = ['/category/film', @@ -90,7 +88,7 @@ def newest(categoria): except: import sys for line in sys.exc_info(): - support.log('newest log: ', {0}.format(line)) + support.log("%s" % line) return [] return itemlist @@ -98,6 +96,7 @@ def newest(categoria): @support.scrape def peliculas(item): + # debug = True if item.contentType == 'movie': action = 'findvideos' elif item.contentType == 'tvshow': diff --git a/channels/dreamsub.py b/channels/dreamsub.py index ab21d6df..3b7108d2 100644 --- a/channels/dreamsub.py +++ b/channels/dreamsub.py @@ -87,7 +87,7 @@ def peliculas(item): if len(item.args) > 1 and item.args[0] == 'last': patronBlock = r'<div id="%s"[^>]+>(?P<block>.*?)<div class="vistaDettagliata"' % item.args[1] - patron = r'<li>\s*<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)" class="thumb">[^>]+>[^>]+>[^>]+>\s*[EePp]+\s*(?P<episode>\d+)[^>]+>[^>]+>[^>]+>(?P<lang>[^<]*)<[^>]+>[^>]+>\s<img src="(?P<thumb>[^"]+)"' + patron = r'<li>\s*<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)" class="thumb">[^>]+>[^>]+>[^>]+>\s*[EePp]+\s*(?P<episode>\d+)[^>]+>\s<img src="(?P<thumb>[^"]+)"' else: patron = r'<div class="showStreaming"> <b>(?P<title>[^<]+)[^>]+>[^>]+>\s*<span>Lingua:\s*(?P<lang>[^>]+)?>[<>br\s]+a href="(?P<url>[^"]+)"[^>]+>.*?--image-url:url\(/*(?P<thumb>[^\)]+).*?Anno di inizio</b>:\s*(?P<year>[0-9]{4})' patronNext = '<li class="currentPage">[^>]+><li[^<]+<a href="([^"]+)">' diff --git a/channels/hd4me.py b/channels/hd4me.py index fc9666fc..1c200508 100644 --- a/channels/hd4me.py +++ b/channels/hd4me.py @@ -3,15 +3,13 @@ # Canale per HD4ME # ------------------------------------------------------------ -from core import httptools, support +from core import support host = support.config.get_channel_url() headers = [['Referer', host]] - - @support.menu def mainlist(item): @@ -19,16 +17,18 @@ def mainlist(item): return locals() + @support.scrape def peliculas(item): # debug = True if item.args == 'alternative': patron = r'<a title="(?P<title>[^\(]+)\(\s*(?P<year>\d+)\)\s\D+(?P<quality>\d+p) ... (?P<lang>[^ ]+).*?[^"]+"\s*href="(?P<url>[^"]+)' else: - patron = r'<a href="(?P<url>[^"]+)" rel="[^"]+" title="(?P<title>[^\(]+)(?!\()\s*\((?P<year>\d+)\)\s\D+(?P<quality>\d+p) ... (?P<lang>[^ ]+).*?<img id="cov" src="(?P<thumb>[^"]+)"' - patronNext = r'rel="next" href="([^"]+)"' + patron = r'<a href="(?P<url>[^"]+)" rel="?[0-9]+"? title="(?P<title>[^\(]+)(?!\()\s*\((?P<year>\d+)\)\s\D+(?P<quality>\d+p).{3}(?P<lang>[^ ]+).*?<img id="?cov"?.*?src="(?P<thumb>[^"]+)' + patronNext = r'rel="?next"? href="([^"]+)"' return locals() + @support.scrape def genre(item): action = 'peliculas' diff --git a/channels/ilgeniodellostreaming.py b/channels/ilgeniodellostreaming.py index d061cd96..7740b79e 100644 --- a/channels/ilgeniodellostreaming.py +++ b/channels/ilgeniodellostreaming.py @@ -89,7 +89,7 @@ def peliculas(item): else: patron = r'<div class="poster">\s?<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> (?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>[^>]+>(?P<year>[^<]+)(?:<.*?<div class="texto">(?P<plot>[^<]+))?' - patronNext = '<span class="current">[^<]+<[^>]+><a href="([^"]+)"' + patronNext = '<span class="current">[^<]+<[^>]+><a href=[\'"]([^\'"]+)[\'"]' #support.regexDbg(item, patron, headers) #debug = True diff --git a/channels/piratestreaming.py b/channels/piratestreaming.py index ee67ed35..ed2082cf 100644 --- a/channels/piratestreaming.py +++ b/channels/piratestreaming.py @@ -8,12 +8,9 @@ from core import support from core.support import config, log host = config.get_channel_url() - - - - headers = [['Referer', host]] + @support.menu def mainlist(item): diff --git a/channels/serietvonline.py b/channels/serietvonline.py index 8b2f9729..98ea0e4a 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -76,7 +76,7 @@ def peliculas(item): elif item.contentType == 'tvshow': # SEZIONE Serie TV- Anime - Documentari - pagination = 35 + # pagination = 35 if not item.args and 'anime' not in item.url: patron = r'<div class="movie">[^>]+>.+?src="(?P<thumb>[^"]+)" alt="[^"]+".+?href="(?P<url>[^"]+)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[ ](?P<rating>\d+.\d+|\d+)<[^>]+>[^>]+><h2>(?P<title>[^"]+)</h2>[ ]?(?:<span class="year">(?P<year>\d+|\-\d+))?<' @@ -85,7 +85,7 @@ def peliculas(item): patron = r'(?:<td>)?<a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<' else: # SEZIONE FILM - pagination = 25 + # pagination = 25 if item.args == 'lista': patron = r'href="(?P<url>[^"]+)"[^>]+>(?P<title>.*?)(?P<year>\d{4})?<' diff --git a/core/support.py b/core/support.py index e19c3303..2e5ac8c9 100755 --- a/core/support.py +++ b/core/support.py @@ -440,7 +440,7 @@ def scrape(func): log('PATRON= ', patron) if not data: page = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True) - data = page.data.replace("'", '"') + data = re.sub("='([^']+)'", '="\\1"', page.data) data = data.replace('\n', ' ') data = data.replace('\t', ' ') data = re.sub(r'>\s+<', '> <', data) @@ -532,7 +532,7 @@ def scrape(func): if config.get_setting('trakt_sync'): from core import trakt_tools trakt_tools.trakt_check(itemlist) - log('scraping time: ' , time()-scrapingTime) + log('scraping time: ', time()-scrapingTime) return itemlist return wrapper @@ -927,6 +927,7 @@ def match(item_url_string, **args): data = data.replace('\n', ' ') data = data.replace('\t', ' ') data = re.sub(r'>\s+<', '><', data) + data = re.sub(r'([a-zA-Z])"([a-zA-Z])', "\1'\2", data) # collect blocks of a page if patronBlock: @@ -1122,6 +1123,7 @@ def nextPage(itemlist, item, data='', patron='', function_or_level=1, next_page= title=typo(config.get_localized_string(30992), 'color kod bold'), url=next_page, args=item.args, + nextPage=True, thumbnail=thumb())) return itemlist diff --git a/tests.py b/tests.py index b541662d..513c0103 100644 --- a/tests.py +++ b/tests.py @@ -155,7 +155,7 @@ class GenericChannelTest(unittest.TestCase): if self.ch in chNumRis: # so a priori quanti risultati dovrebbe dare for content in chNumRis[self.ch]: if content in it.title: - risNum = len(itemlist) - 1 # - nextpage + risNum = len([it for it in itemlist if not it.nextPage]) # not count nextpage self.assertEqual(chNumRis[self.ch][content], risNum, 'channel ' + self.ch + ' -> ' + it.title + ' returned wrong number of results') break