diff --git a/channels.json b/channels.json index 0db9d177..c10d9dac 100644 --- a/channels.json +++ b/channels.json @@ -14,6 +14,7 @@ "casacinemaInfo": "https://casacinema.blue", "cb01anime": "https://www.cineblog01.ink", "cinetecadibologna": "http://cinestore.cinetecadibologna.it", + "cinemalibero": "https://www.cinemalibero.today", "dreamsub": "https://dreamsub.stream", "dsda": "https://www.dsda.press/", "fastsubita": "https://fastsubita.online", diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 861fa864..a97d4602 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -12,7 +12,7 @@ from platformcode import logger, config def findhost(): - permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers + permUrl = httptools.downloadpage('https://cb01-nuovo-indirizzo.info/', follow_redirects=False, only_headers=True).headers if 'google' in permUrl['location']: host = permUrl['location'].replace('https://www.google.it/search?q=site:', '') else: diff --git a/channels/cinemalibero.py b/channels/cinemalibero.py index de0d93aa..10408118 100644 --- a/channels/cinemalibero.py +++ b/channels/cinemalibero.py @@ -12,18 +12,19 @@ from platformcode import config list_servers = ['akstream', 'wstream', 'backin', 'clipwatching', 'cloudvideo', 'verystream', 'onlystream', 'mixdrop'] list_quality = ['default'] -def findhost(): - permUrl = httptools.downloadpage('https://www.cinemalibero.online/', follow_redirects=False).headers - try: - import urlparse - except: - import urllib.parse as urlparse - p = list(urlparse.urlparse(permUrl['location'].replace('https://www.google.com/search?q=site:', ''))) - if not p[0]: - p[0] = 'https' - return urlparse.urlunparse(p) +# rimanda a .today che contiene tutti link a .plus +# def findhost(): +# permUrl = httptools.downloadpage('https://www.cinemalibero.online/', follow_redirects=False).headers +# try: +# import urlparse +# except: +# import urllib.parse as urlparse +# p = list(urlparse.urlparse(permUrl['location'].replace('https://www.google.com/search?q=site:', ''))) +# if not p[0]: +# p[0] = 'https' +# return urlparse.urlunparse(p) -host = config.get_channel_url(findhost) +host = config.get_channel_url() headers = [['Referer', host]] @support.menu diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index 2cc3cadb..180a0339 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -16,7 +16,7 @@ from core import scrapertools, httptools, support from core.item import Item def findhost(): - permUrl = httptools.downloadpage('https://eurostreaming.link/', follow_redirects=False).headers + permUrl = httptools.downloadpage('https://eurostreaming.link/', follow_redirects=False, only_headers=True).headers host = 'https://'+permUrl['location'].replace('https://www.google.it/search?q=site:', '') return host diff --git a/channels/streamingaltadefinizione.py b/channels/streamingaltadefinizione.py index 408f93ce..63e24fa9 100644 --- a/channels/streamingaltadefinizione.py +++ b/channels/streamingaltadefinizione.py @@ -12,7 +12,7 @@ list_servers = ['verystream', 'openload', 'wstream'] list_quality = ['1080p', 'HD', 'DVDRIP', 'SD', 'CAM'] def findhost(): - permUrl = httptools.downloadpage('https://www.popcornstream.info', follow_redirects=False).headers + permUrl = httptools.downloadpage('https://www.popcornstream.info', follow_redirects=False, only_headers=True).headers if 'google' in permUrl['location']: host = permUrl['location'].replace('https://www.google.it/search?q=site:', '') if host[:4] != 'http': diff --git a/core/httptools.py b/core/httptools.py index dfd72487..f4a08d28 100755 --- a/core/httptools.py +++ b/core/httptools.py @@ -123,6 +123,7 @@ def load_cookies(alfa_s=False): os.remove(cookies_file) cookies_lock.release() +load_cookies() def save_cookies(alfa_s=False): cookies_lock.acquire() @@ -255,7 +256,6 @@ def downloadpage(url, **opt): """ url = scrapertools.unescape(url) - load_cookies() domain = urlparse.urlparse(url).netloc global domainCF CF = False diff --git a/core/support.py b/core/support.py index 7da693c0..46b37068 100755 --- a/core/support.py +++ b/core/support.py @@ -387,7 +387,8 @@ def scrape(func): if not data: page = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True) # if url may be changed and channel has findhost to update - if (not page.data or scrapertools.get_domain_from_url(page.url) != scrapertools.get_domain_from_url(item.url)) and 'findhost' in func.__globals__: + if 'findhost' in func.__globals__ and (not page.data or scrapertools.get_domain_from_url(page.url).lower() != scrapertools.get_domain_from_url(item.url).lower()): + logger.info('running findhost ' + func.__module__) host = func.__globals__['findhost']() parse = list(urlparse.urlparse(item.url)) from core import jsontools diff --git a/platformcode/config.py b/platformcode/config.py index af826fe3..0a35086c 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -18,6 +18,8 @@ PLUGIN_NAME = "kod" __settings__ = xbmcaddon.Addon(id="plugin.video." + PLUGIN_NAME) __language__ = __settings__.getLocalizedString +__version_fix = None +__dev_mode = None channels_data = list() @@ -36,19 +38,25 @@ def get_addon_version(with_fix=True): def get_addon_version_fix(): - if not dev_mode(): - try: - sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline() - return sha[:7] - except: - return '??' - else: - return 'DEV' + global __version_fix + ret = __version_fix + if not ret: + if not dev_mode(): + try: + sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline() + ret = sha[:7] + except: + ret = '??' + else: + ret = 'DEV' + return ret def dev_mode(): - r = os.path.isdir(get_runtime_path() + '/.git') - return r + global __dev_mode + if not __dev_mode: + __dev_mode = os.path.isdir(get_runtime_path() + '/.git') + return __dev_mode def get_platform(full_version=False): diff --git a/servers/backin.py b/servers/backin.py index 47273baa..c070d5d6 100644 --- a/servers/backin.py +++ b/servers/backin.py @@ -12,7 +12,7 @@ def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) if 'http://' in page_url: # fastids - page_url = httptools.downloadpage(page_url, follow_redirects=False).headers['location'] + page_url = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True).headers['location'] page_url = scrapertools.find_single_match(page_url, 'backin.net/([a-zA-Z0-9]+)') global data data = httptools.downloadpage("http://backin.net/stream-%s-500x400.html" % page_url).data diff --git a/servers/wstream.py b/servers/wstream.py index 08960158..c80043ec 100644 --- a/servers/wstream.py +++ b/servers/wstream.py @@ -24,7 +24,7 @@ def test_video_exists(page_url): page_url = resp.url if '/streaming.php' in page_url in page_url: - code = httptools.downloadpage(page_url, headers=headers, follow_redirects=False).headers['location'].split('/')[-1].replace('.html', '') + code = httptools.downloadpage(page_url, headers=headers, follow_redirects=False, only_headers=True).headers['location'].split('/')[-1].replace('.html', '') # logger.info('WCODE=' + code) page_url = 'https://wstream.video/video.php?file_code=' + code data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True).data diff --git a/specials/news.py b/specials/news.py index 20acf925..21bb5f41 100644 --- a/specials/news.py +++ b/specials/news.py @@ -51,7 +51,7 @@ def mainlist(item): logger.info() itemlist = [] - list_canales, any_active = get_channels_list() + # list_canales, any_active = get_channels_list() channel_language = config.get_setting("channel_language", default="auto") if channel_language == 'auto': channel_language = auto_filter() diff --git a/specials/tvmoviedb.py b/specials/tvmoviedb.py index baa4feb6..dc6263b2 100644 --- a/specials/tvmoviedb.py +++ b/specials/tvmoviedb.py @@ -1892,7 +1892,7 @@ def newlist(item): # Creación de nueva lista en filmaffinity itemlist = [] if item.accion == "lista": - location = httptools.downloadpage(item.url).headers["location"] + location = httptools.downloadpage(item.url, only_headers=True).headers["location"] data = httptools.downloadpage("http://m.filmaffinity.com" + location).data itemlist.append(item.clone(action="", title=config.get_localized_string(70338))) else: