From c48e15d55d6140bd30af2a84fd9bbd6edaa22d01 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Wed, 12 May 2021 21:17:57 +0200 Subject: [PATCH 01/11] Alcune migliorie --- core/__init__.py | 10 ++++++---- lib/sqlitedict.py | 6 +++--- platformcode/launcher.py | 3 --- service.py | 17 +++++++---------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index b232b5c2..ac442dbe 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -14,7 +14,7 @@ except: from . import filetools from platformcode import config from collections import defaultdict -from lib.sqlitedict import SqliteDict +from lib.sqlitedict import SqliteDict, SqliteMultithread class nested_dict_sqlite(defaultdict): @@ -25,10 +25,12 @@ class nested_dict_sqlite(defaultdict): return value def close(self): - for key in self.keys(): - self[key].close() + sqliteTH.close() + # for key in self.keys(): + # self[key].close() self.clear() db_name = filetools.join(config.get_data_path(), "db.sqlite") -db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True)) +sqliteTH = SqliteMultithread(db_name, autocommit=True, journal_mode="DELETE", timeout=5) +db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True, conn=sqliteTH)) diff --git a/lib/sqlitedict.py b/lib/sqlitedict.py index 93884a4e..6beb08e2 100644 --- a/lib/sqlitedict.py +++ b/lib/sqlitedict.py @@ -109,7 +109,7 @@ class SqliteDict(DictClass): VALID_FLAGS = ['c', 'r', 'w', 'n'] def __init__(self, filename=None, tablename='unnamed', flag='c', - autocommit=False, journal_mode="DELETE", encode=encode, decode=decode, timeout=5): + autocommit=False, journal_mode="DELETE", encode=encode, decode=decode, timeout=5, conn=None): """ Initialize a thread-safe sqlite-backed dictionary. The dictionary will be a table `tablename` in database file `filename`. A single file (=database) @@ -174,7 +174,7 @@ class SqliteDict(DictClass): self.timeout = timeout logger.info("opening Sqlite table %r in %r" % (tablename, filename)) - self.conn = self._new_conn() + self.conn = self._new_conn() if not conn else conn if self.flag == 'r': if self.tablename not in SqliteDict.get_tablenames(self.filename): msg = 'Refusing to create a new table "%s" in read-only DB mode' % tablename @@ -593,7 +593,7 @@ class SqliteMultithread(Thread): while time.time() - start_time < self.timeout: if self._sqlitedict_thread_initialized or self.exception: return - time.sleep(0.1) + time.sleep(0.01) raise TimeoutError("SqliteMultithread failed to flag initialization withing %0.0f seconds." % self.timeout) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 6e41f12a..da9379cc 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -35,9 +35,6 @@ def start(): def run(item=None): logger.debug() - # for saving viewmode for precedent menu - platformtools.viewmodeMonitor() - if not item: # Extract item from sys.argv if sys.argv[2]: diff --git a/service.py b/service.py index cf225499..4ad50208 100644 --- a/service.py +++ b/service.py @@ -89,21 +89,18 @@ def update(path, p_dialog, i, t, serie, overwrite): # serie.infoLabels['playcount'] = serie.playcount insertados_total += insertados - except Exception as ex: + except: + import traceback logger.error("Error when saving the chapters of the series") - template = "An exception of type %s occured. Arguments:\n%r" - message = template % (type(ex).__name__, ex.args) - logger.error(message) + logger.error(traceback.format_exc()) - except Exception as ex: + except: + import traceback logger.error("Error in obtaining the episodes of: %s" % serie.show) - template = "An exception of type %s occured. Arguments:\n%r" - message = template % (type(ex).__name__, ex.args) - logger.error(message) + logger.error(traceback.format_exc()) else: logger.debug("Channel %s not active is not updated" % serie.channel) - # Synchronize the episodes seen from the Kodi video library with that of KoD try: if config.is_xbmc(): # If it's Kodi, we do it @@ -127,7 +124,7 @@ def check_for_update(overwrite=True): if config.get_setting("update", "videolibrary") != 0 or overwrite: config.set_setting("updatelibrary_last_check", hoy.strftime('%Y-%m-%d'), "videolibrary") - heading = config.get_localized_string(60389) + heading = config.get_localized_string(60601) p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), heading) p_dialog.update(0, '') show_list = [] From 5dfd4a09c2641a7f673c32d01d19057e45fdc532 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Thu, 13 May 2021 12:29:33 +0200 Subject: [PATCH 02/11] Fix Animeworld --- channels/animeworld.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index aa43efae..408650f9 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -19,13 +19,13 @@ def get_cookie(): headers = [['Cookie', cookie]] -if not cookie: - get_cookie() - - def get_data(item): + support.dbg() url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url data = support.match(url, headers=headers, follow_redirects=True).data + if 'AWCookieVerify' in data: + get_cookie() + get_data(item) return data @@ -49,7 +49,7 @@ def mainlist(item): @support.scrape def genres(item): action = 'peliculas' - # data = get_data(item) + data = get_data(item) patronBlock = r'dropdown[^>]*>\s*Generi\s*]+>(?P.*?)' patronMenu = r'[^"]+)" value="(?P[^"]+)"\s*>[^>]+>(?P[^<]+)</label>' @@ -62,7 +62,7 @@ def genres(item): @support.scrape def menu(item): action = 'submenu' - # data = get_data(item) + data = get_data(item) patronMenu=r'<button[^>]+>\s*(?P<title>[A-Za-z0-9]+)\s*<span.[^>]+>(?P<other>.*?)</ul>' def itemlistHook(itemlist): itemlist.insert(0, item.clone(title=support.typo('Tutti','bold'), action='peliculas')) @@ -121,13 +121,9 @@ def peliculas(item): anime=True # debug =True if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale - data = support.httptools.downloadpage(item.url, headers=headers).data - if 'AWCookietest' in data: - get_cookie() - data = support.match(item.url).data + data = get_data(item) if item.args == 'updated': - # data = get_data(item) item.contentType='episode' patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img.*?src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?[^>]+>[^>]+>\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>' action='findvideos' @@ -172,7 +168,7 @@ def findvideos(item): itemlist = [] urls = [] # resp = support.match(get_data(item), headers=headers, patron=r'data-name="(\d+)">([^<]+)<') - resp = support.match(item, headers=headers, patron=r'data-name="(\d+)">([^<]+)<') + resp = support.match(get_data(item), headers=headers, patron=r'data-name="(\d+)">([^<]+)<') data = resp.data for ID, name in resp.matches: From 3f72cebd96bfd838ff04e32653a36c854c7a4ab7 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Thu, 13 May 2021 20:13:13 +0200 Subject: [PATCH 03/11] ops --- channels/animeworld.py | 2 +- core/__init__.py | 10 ++++------ lib/sqlitedict.py | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index 408650f9..b61fa412 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -20,7 +20,7 @@ def get_cookie(): def get_data(item): - support.dbg() + # support.dbg() url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url data = support.match(url, headers=headers, follow_redirects=True).data if 'AWCookieVerify' in data: diff --git a/core/__init__.py b/core/__init__.py index ac442dbe..b232b5c2 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -14,7 +14,7 @@ except: from . import filetools from platformcode import config from collections import defaultdict -from lib.sqlitedict import SqliteDict, SqliteMultithread +from lib.sqlitedict import SqliteDict class nested_dict_sqlite(defaultdict): @@ -25,12 +25,10 @@ class nested_dict_sqlite(defaultdict): return value def close(self): - sqliteTH.close() - # for key in self.keys(): - # self[key].close() + for key in self.keys(): + self[key].close() self.clear() db_name = filetools.join(config.get_data_path(), "db.sqlite") -sqliteTH = SqliteMultithread(db_name, autocommit=True, journal_mode="DELETE", timeout=5) -db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True, conn=sqliteTH)) +db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True)) diff --git a/lib/sqlitedict.py b/lib/sqlitedict.py index 6beb08e2..3d0082c5 100644 --- a/lib/sqlitedict.py +++ b/lib/sqlitedict.py @@ -109,7 +109,7 @@ class SqliteDict(DictClass): VALID_FLAGS = ['c', 'r', 'w', 'n'] def __init__(self, filename=None, tablename='unnamed', flag='c', - autocommit=False, journal_mode="DELETE", encode=encode, decode=decode, timeout=5, conn=None): + autocommit=False, journal_mode="DELETE", encode=encode, decode=decode, timeout=5): """ Initialize a thread-safe sqlite-backed dictionary. The dictionary will be a table `tablename` in database file `filename`. A single file (=database) @@ -174,7 +174,7 @@ class SqliteDict(DictClass): self.timeout = timeout logger.info("opening Sqlite table %r in %r" % (tablename, filename)) - self.conn = self._new_conn() if not conn else conn + self.conn = self._new_conn() if self.flag == 'r': if self.tablename not in SqliteDict.get_tablenames(self.filename): msg = 'Refusing to create a new table "%s" in read-only DB mode' % tablename From bb4ccff33995b82284c2ada524096dc60d1309f1 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Fri, 14 May 2021 18:00:08 +0200 Subject: [PATCH 04/11] Fix grafico "cerca negli altri canali" --- specials/globalsearch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 8d156f3f..fce4723b 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -300,10 +300,12 @@ class SearchWindow(xbmcgui.WindowXML): return channels_list def timer(self): - while self.searchActions: + while self.searchActions or self.thActions.is_alive(): if self.exit: return - percent = (float(self.count) / len(self.searchActions)) * 100 - self.LOADING.setVisible(False) + try: + percent = (float(self.count) / len(self.searchActions)) * 100 + except ZeroDivisionError: + percent = 0 self.PROGRESS.setPercent(percent) self.COUNT.setText('%s/%s [%s"]' % (self.count, len(self.searchActions), int(time.time() - self.time))) if percent == 100: @@ -408,6 +410,7 @@ class SearchWindow(xbmcgui.WindowXML): return it def update(self, channel, valid, results): + self.LOADING.setVisible(False) if self.exit: return logger.debug('Search on channel', channel) From f8647df9e0666cc79234c165208e8a3ed3f46e93 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Fri, 14 May 2021 20:43:04 +0200 Subject: [PATCH 05/11] Fix cb01->ultimi/e aggiornati/e, wstream e piccole migliorie --- channels/animeworld.py | 4 ++-- channels/cineblog01.py | 14 ++++++-------- channels/tantifilm.py | 4 ++-- servers/vidmoly.py | 2 +- servers/vupplayer.py | 2 +- servers/wstream.py | 4 ++-- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index b61fa412..1b90ef94 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -118,8 +118,8 @@ def search(item, texto): @support.scrape def peliculas(item): - anime=True - # debug =True + anime = True + # debug = True if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale data = get_data(item) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 2f8e91b6..e58bf433 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -27,14 +27,14 @@ def mainlist(item): ('Generi', ['', 'menu', 'Film per Genere']), ('Anni', ['', 'menu', 'Film per Anno']), ('Paese', ['', 'menu', 'Film per Paese']), - ('Ultimi Aggiornati', ['/lista-film-ultimi-100-film-aggiornati/', 'peliculas', 'newest']), + ('Ultimi Aggiornati', ['/ultimi-100-film-aggiornati/', 'peliculas', 'newest']), ('Ultimi Aggiunti', ['/lista-film-ultimi-100-film-aggiunti/', 'peliculas', 'newest']) ] tvshow = ['/serietv/', ('Per Lettera', ['/serietv/', 'menu', 'Serie-Tv per Lettera']), ('Per Genere', ['/serietv/', 'menu', 'Serie-Tv per Genere']), ('Per anno', ['/serietv/', 'menu', 'Serie-Tv per Anno']), - ('Ultime Aggiornate', ['/serietv/', 'peliculas', 'newest']) + ('Ultime Aggiornate', ['/serietv/ultime-100-serie-tv-aggiornate/', 'peliculas', 'newest']) ] docu = [('Documentari {bullet bold}', ['/category/documentario/', 'peliculas']), ('HD {submenu} {documentari}', ['/category/hd-alta-definizione/documentario-hd/', 'peliculas']) @@ -97,16 +97,14 @@ def peliculas(item): 'Openload: la situazione. Benvenuto Verystream', 'Openload: lo volete ancora?', 'OSCAR ' + str(curYear) + ' ▶ VOTA IL TUO FILM PREFERITO! 🎬', 'Auguri di Buon Natale e Felice Anno Nuovo! – ' + str(curYear) + '!'] - # debug= True + # debug = True if 'newest' in item.args: + pagination = '' + patronBlock = r'sequex-page-left(?P<block>.*?)sequex-page-right' if '/serietv/' not in item.url: - # debug = True - pagination = '' - patronBlock = r'Ultimi 100 film [^:]+:(?P<block>.*?)<\/td>' - patron = r'<a href="?(?P<url>[^">]+)"?>(?P<title>[^<([]+)(?:\[(?P<lang>Sub-ITA|B/N|SUB-ITA)\])?\s*(?:\[(?P<quality>HD|SD|HD/3D)\])?\s*\((?P<year>[0-9]{4})\)<\/a>' + patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?\((?P<year>\d{4})[^\)]*\))(?: – \d+×\d+)?(?:>|"| – )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)(?P<plot>[^<]+)<' action = 'findvideos' else: - patronBlock = r'Ultime SerieTv aggiornate(?P<block>.*?)Lista' patron = r'src=(?:")?(?P<thumb>[^ "]+)(?:")? alt=(?:")?(?P<title>.*?)(?: – \d+×\d+)?(?:>|"| – )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>[^\(]*)\((?P<year>\d{4})[^\)]*\) (?P<plot>[^<]+)<' action = 'episodios' diff --git a/channels/tantifilm.py b/channels/tantifilm.py index 56164c81..320314b6 100644 --- a/channels/tantifilm.py +++ b/channels/tantifilm.py @@ -48,12 +48,12 @@ def mainlist(item): @support.scrape def peliculas(item): - # debug=True + # debug = True if item.args == 'search': patron = r'<a href="(?P<url>[^"]+)" title="Permalink to\s*(?P<title>[^"]+) \((?P<year>[0-9]+)[^<]*\)[^"]*"[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)".*?<div class="calitate">\s*<p>(?P<quality>[^<]+)<\/p>' else: patronNext = r'<a class="nextpostslink" rel="next" href="([^"]+)">' - patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?' + patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*(?:<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*)?<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?' patronBlock = r'<div id="main_col">(?P<block>.*?)<!\-\- main_col \-\->' # if item.args != 'all' and item.args != 'search': diff --git a/servers/vidmoly.py b/servers/vidmoly.py index 8c992d23..14d775a3 100644 --- a/servers/vidmoly.py +++ b/servers/vidmoly.py @@ -9,7 +9,7 @@ def test_video_exists(page_url): global data resp = httptools.downloadpage(page_url) data = resp.data - if resp.code == 404: + if resp.code == 404 or 'Video is processing now' in data: return False, config.get_localized_string(70449) % "Vidmoly" return True, "" diff --git a/servers/vupplayer.py b/servers/vupplayer.py index f6cb7bd3..8ea795f6 100644 --- a/servers/vupplayer.py +++ b/servers/vupplayer.py @@ -9,7 +9,7 @@ def test_video_exists(page_url): page = httptools.downloadpage(page_url) global data data = page.data - if page.code == 404 or 'File is no longer available' in data: + if page.code == 404 or 'File is no longer available' in data or "We're sorry!" in data: return False, config.get_localized_string(70449) % "VUP Player" return True, "" diff --git a/servers/wstream.py b/servers/wstream.py index 2d9c44d8..e5cae1f0 100644 --- a/servers/wstream.py +++ b/servers/wstream.py @@ -19,12 +19,12 @@ errorsStr = ['Sorry this file is not longer available', 'Sorry this video is una def test_video_exists(page_url): logger.debug("(page_url='%s')" % page_url) disable_directIP = False - # if 'swvideoid' in page_url: disable_directIP = True + if 'swvideoid' in page_url: disable_directIP = True resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False) while resp.headers.get('location'): page_url = resp.headers.get('location') - resp = httptools.downloadpage(page_url.replace('https:', 'http:'), verify=False, disable_directIP=disable_directIP, follow_redirects=False) + resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False) global data, real_url data = resp.data From 87541fb1e4960489b9c4ea2a22eccc18d2ad205f Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Sat, 15 May 2021 10:38:41 +0200 Subject: [PATCH 06/11] fix wstream e animesaturn --- channels/animesaturn.py | 25 ++++++++++++++++++++++++- channels/animeworld.py | 8 ++++---- servers/wstream.py | 6 +++--- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/channels/animesaturn.py b/channels/animesaturn.py index baa17216..a9f7c569 100644 --- a/channels/animesaturn.py +++ b/channels/animesaturn.py @@ -8,7 +8,27 @@ from core import support from platformcode import config host = support.config.get_channel_url() -headers={'X-Requested-With': 'XMLHttpRequest'} +__channel__ = 'animesaturn' +cookie = support.config.get_setting('cookie', __channel__) +headers = {'X-Requested-With': 'XMLHttpRequest', 'Cookie': cookie} + + +def get_cookie(data): + global cookie, headers + cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match + support.config.set_setting('cookie', cookie, __channel__) + headers = [['Cookie', cookie]] + + +def get_data(item): + # support.dbg() + # url = support.match(item.url, headers=headers, follow_redirects=True, only_headers=True).url + data = support.match(item.url, headers=headers, follow_redirects=True).data + if 'ASCookie' in data: + get_cookie(data) + data = get_data(item) + return data + @support.menu def mainlist(item): @@ -96,6 +116,9 @@ def peliculas(item): action = 'check' page = None post = "page=" + str(item.page if item.page else 1) if item.page and int(item.page) > 1 else None + data = get_data(item) + + # debug = True if item.args == 'top': data = item.other diff --git a/channels/animeworld.py b/channels/animeworld.py index 1b90ef94..f443070c 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -12,9 +12,9 @@ cookie = support.config.get_setting('cookie', __channel__) headers = [['Cookie', cookie]] -def get_cookie(): +def get_cookie(data): global cookie, headers - cookie = support.match(host, patron=r'document.cookie="([^\s]+)').match + cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match support.config.set_setting('cookie', cookie, __channel__) headers = [['Cookie', cookie]] @@ -24,8 +24,8 @@ def get_data(item): url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url data = support.match(url, headers=headers, follow_redirects=True).data if 'AWCookieVerify' in data: - get_cookie() - get_data(item) + get_cookie(data) + data = get_data(item) return data diff --git a/servers/wstream.py b/servers/wstream.py index e5cae1f0..5d33f622 100644 --- a/servers/wstream.py +++ b/servers/wstream.py @@ -19,12 +19,12 @@ errorsStr = ['Sorry this file is not longer available', 'Sorry this video is una def test_video_exists(page_url): logger.debug("(page_url='%s')" % page_url) disable_directIP = False - if 'swvideoid' in page_url: disable_directIP = True + # if 'swvideoid' in page_url: disable_directIP = True - resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False) + resp = httptools.downloadpage(page_url.replace('https:', 'http:'), verify=False, disable_directIP=disable_directIP, follow_redirects=False) while resp.headers.get('location'): page_url = resp.headers.get('location') - resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False) + resp = httptools.downloadpage(page_url.replace('https:', 'http:'), verify=False, disable_directIP=disable_directIP, follow_redirects=False) global data, real_url data = resp.data From cc3eb243172d9c31a797828c2469c4cfe5edcbce Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Sat, 15 May 2021 13:08:43 +0200 Subject: [PATCH 07/11] CB01: migliorato riconoscimento titoli in sezione Ultimi aggiunti --- channels/cineblog01.py | 3 ++- core/support.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index e58bf433..6e56c21d 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -88,6 +88,7 @@ def search(item, text): logger.error("%s" % line) return [] + @support.scrape def peliculas(item): # esclusione degli articoli 'di servizio' @@ -102,7 +103,7 @@ def peliculas(item): pagination = '' patronBlock = r'sequex-page-left(?P<block>.*?)sequex-page-right' if '/serietv/' not in item.url: - patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?\((?P<year>\d{4})[^\)]*\))(?: – \d+×\d+)?(?:>|"| – )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)(?P<plot>[^<]+)<' + patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?\((?P<year>\d{4})[^\)]*\)[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)[^ ]+ [^ ]+ [A-Z ]+ (?P<plot>[^<]+)<' action = 'findvideos' else: patron = r'src=(?:")?(?P<thumb>[^ "]+)(?:")? alt=(?:")?(?P<title>.*?)(?: – \d+×\d+)?(?:>|"| – )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>[^\(]*)\((?P<year>\d{4})[^\)]*\) (?P<plot>[^<]+)<' diff --git a/core/support.py b/core/support.py index e5af37cc..dacf5a8a 100755 --- a/core/support.py +++ b/core/support.py @@ -244,11 +244,11 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if scraped["plot"]: infolabels['plot'] = plot if scraped['duration']: - matches = scrapertools.find_multiple_matches(scraped['duration'], + dur = scrapertools.find_multiple_matches(scraped['duration'], r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') - for h, m in matches: + for h, m in dur: scraped['duration'] = int(h) * 60 + int(m) - if not matches: + if not dur: scraped['duration'] = scrapertools.find_single_match(scraped['duration'], r'(\d+)') try: infolabels['duration'] = int(scraped['duration']) * 60 From 3256b0d8e8a528dd38fe3ed9087fb720fb330ce1 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Sun, 16 May 2021 17:57:21 +0200 Subject: [PATCH 08/11] =?UTF-8?q?Fix=20sezione=20novit=C3=A0=20(cb01)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/cineblog01.py | 2 +- specials/news.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 6e56c21d..3d99c385 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -63,7 +63,7 @@ def newest(categoria): else: item.contentType = 'movie' item.url = host + '/lista-film-ultimi-100-film-aggiunti/' - item.args = "newest" + item.args = "newest" return peliculas(item) # Continua la ricerca in caso di errore except: diff --git a/specials/news.py b/specials/news.py index 6618a9b3..208b3801 100644 --- a/specials/news.py +++ b/specials/news.py @@ -285,7 +285,7 @@ def novedades(item): else: if mode == 'normal': logger.debug("Obteniendo novedades de channel_id=" + channel_id) - progreso.update(percentage, "", config.get_localized_string(60520) % channel_title) + progreso.update(percentage, config.get_localized_string(60520) % channel_title) get_newest(channel_id, item.extra) # Multi Thread mode: wait for all threads to finish From a74a5eb5dc19945a99f554af800c26d950204d5e Mon Sep 17 00:00:00 2001 From: Alhaziel01 <alhaziel01@gmail.com> Date: Mon, 17 May 2021 18:52:06 +0200 Subject: [PATCH 09/11] Fix Cb01 --- channels/cineblog01.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 3d99c385..a57bbc60 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -98,19 +98,19 @@ def peliculas(item): 'Openload: la situazione. Benvenuto Verystream', 'Openload: lo volete ancora?', 'OSCAR ' + str(curYear) + ' ▶ VOTA IL TUO FILM PREFERITO! 🎬', 'Auguri di Buon Natale e Felice Anno Nuovo! – ' + str(curYear) + '!'] - # debug = True + if 'newest' in item.args: pagination = '' patronBlock = r'sequex-page-left(?P<block>.*?)sequex-page-right' if '/serietv/' not in item.url: - patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?\((?P<year>\d{4})[^\)]*\)[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)[^ ]+ [^ ]+ [A-Z ]+ (?P<plot>[^<]+)<' + patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?(?:\[(?P<quality2>[a-zA-Z/]+)\]\s*)?\((?P<year>\d{4})[^\)]*\)[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)[^ ]+ [^ ]+ [A-Z ]+ (?P<plot>[^<]+)<' action = 'findvideos' else: patron = r'src=(?:")?(?P<thumb>[^ "]+)(?:")? alt=(?:")?(?P<title>.*?)(?: – \d+×\d+)?(?:>|"| – )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>[^\(]*)\((?P<year>\d{4})[^\)]*\) (?P<plot>[^<]+)<' action = 'episodios' elif '/serietv/' not in item.url: - patron = r'<div class="card-image">\s*<a[^>]+>\s*<img src="(?P<thumb>[^" ]+)" alt[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="?(?P<url>[^" >]+)(?:\/|"|\s+)>(?P<title>[^<[(]+)(?:\[(?P<quality>[A-Za-z0-9/-]+)])? (?:\((?P<year>[0-9]{4})\))?[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<genre>[^<>&‖“]+)(?:[^ ]+\s*DURATA\s*(?P<duration>[0-9]+)[^>]+>[^>]+>[^>]+>(?P<plot>[^<>]+))?' + patron = r'<div class="card-image">\s*<a[^>]+>\s*<img src="(?P<thumb>[^" ]+)" alt[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="?(?P<url>[^" >]+)(?:\/|"|\s+)>(?P<title>[^<[(]+)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?(?:\[(?P<quality2>[a-zA-Z/]+)\]\s*)? (?:\((?P<year>[0-9]{4})\))?[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<genre>[^<>&‖“]+)(?:[^ ]+\s*DURATA\s*(?P<duration>[0-9]+)[^>]+>[^>]+>[^>]+>(?P<plot>[^<>]+))?' action = 'findvideos' else: @@ -120,6 +120,12 @@ def peliculas(item): patronNext = '<a class="?page-link"? href="?([^>"]+)"?><i class="fa fa-angle-right">' + def itemHook(item): + if item.quality2: + item.quality = item.quality2 + item.title += support.typo(item.quality2, '_ [] color kod') + return item + return locals() From 8ede1efe6fa4f7f6a2113f12b9eb9b4a6e042234 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Mon, 17 May 2021 20:16:50 +0200 Subject: [PATCH 10/11] Cache tmdb: riprova se risposta vuota --- core/tmdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tmdb.py b/core/tmdb.py index 4d3f14a0..ee2133f3 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -128,7 +128,7 @@ def cache_response(fn): result = fn(*args) else: - url = re.sub('&year=-', '', args[0]) + url = args[0].replace('&year=-', '') # if PY3: url = str.encode(url) row = db['tmdb_cache'].get(url) @@ -137,7 +137,7 @@ def cache_response(fn): result = row[0] # si no se ha obtenido información, llamamos a la funcion - if not result: + if not result.get('results'): result = fn(*args) db['tmdb_cache'][url] = [result, datetime.datetime.now()] From b431109fcb821efdc8bafe980884329d2333b38e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com> Date: Thu, 20 May 2021 18:09:43 +0000 Subject: [PATCH 11/11] {Aggiornamento domini} --- channels.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels.json b/channels.json index fa8d3654..87fc8197 100644 --- a/channels.json +++ b/channels.json @@ -21,7 +21,7 @@ "filmigratis": "https://filmigratis.org", "guardaseriecam": "https://guardaserie.cam", "guardaserieclick": "https://www.guardaserie.support", - "guardaserieicu": "https://guardaserie.asia", + "guardaserieicu": "https://guardaserie.agency", "hd4me": "https://hd4me.net", "ilcorsaronero": "https://ilcorsaronero.link", "ilgeniodellostreaming": "https://ilgeniodellostreaming.ist",