altre ottimizzazioni

This commit is contained in:
marco
2020-03-31 14:49:00 +02:00
parent e44578c4a3
commit ff79e499a9
12 changed files with 41 additions and 30 deletions
+1
View File
@@ -14,6 +14,7 @@
"casacinemaInfo": "https://casacinema.blue", "casacinemaInfo": "https://casacinema.blue",
"cb01anime": "https://www.cineblog01.ink", "cb01anime": "https://www.cineblog01.ink",
"cinetecadibologna": "http://cinestore.cinetecadibologna.it", "cinetecadibologna": "http://cinestore.cinetecadibologna.it",
"cinemalibero": "https://www.cinemalibero.today",
"dreamsub": "https://dreamsub.stream", "dreamsub": "https://dreamsub.stream",
"dsda": "https://www.dsda.press/", "dsda": "https://www.dsda.press/",
"fastsubita": "https://fastsubita.online", "fastsubita": "https://fastsubita.online",
+1 -1
View File
@@ -12,7 +12,7 @@ from platformcode import logger, config
def findhost(): 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']: if 'google' in permUrl['location']:
host = permUrl['location'].replace('https://www.google.it/search?q=site:', '') host = permUrl['location'].replace('https://www.google.it/search?q=site:', '')
else: else:
+12 -11
View File
@@ -12,18 +12,19 @@ from platformcode import config
list_servers = ['akstream', 'wstream', 'backin', 'clipwatching', 'cloudvideo', 'verystream', 'onlystream', 'mixdrop'] list_servers = ['akstream', 'wstream', 'backin', 'clipwatching', 'cloudvideo', 'verystream', 'onlystream', 'mixdrop']
list_quality = ['default'] list_quality = ['default']
def findhost(): # rimanda a .today che contiene tutti link a .plus
permUrl = httptools.downloadpage('https://www.cinemalibero.online/', follow_redirects=False).headers # def findhost():
try: # permUrl = httptools.downloadpage('https://www.cinemalibero.online/', follow_redirects=False).headers
import urlparse # try:
except: # import urlparse
import urllib.parse as urlparse # except:
p = list(urlparse.urlparse(permUrl['location'].replace('https://www.google.com/search?q=site:', ''))) # import urllib.parse as urlparse
if not p[0]: # p = list(urlparse.urlparse(permUrl['location'].replace('https://www.google.com/search?q=site:', '')))
p[0] = 'https' # if not p[0]:
return urlparse.urlunparse(p) # p[0] = 'https'
# return urlparse.urlunparse(p)
host = config.get_channel_url(findhost) host = config.get_channel_url()
headers = [['Referer', host]] headers = [['Referer', host]]
@support.menu @support.menu
+1 -1
View File
@@ -16,7 +16,7 @@ from core import scrapertools, httptools, support
from core.item import Item from core.item import Item
def findhost(): 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:', '') host = 'https://'+permUrl['location'].replace('https://www.google.it/search?q=site:', '')
return host return host
+1 -1
View File
@@ -12,7 +12,7 @@ list_servers = ['verystream', 'openload', 'wstream']
list_quality = ['1080p', 'HD', 'DVDRIP', 'SD', 'CAM'] list_quality = ['1080p', 'HD', 'DVDRIP', 'SD', 'CAM']
def findhost(): 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']: if 'google' in permUrl['location']:
host = permUrl['location'].replace('https://www.google.it/search?q=site:', '') host = permUrl['location'].replace('https://www.google.it/search?q=site:', '')
if host[:4] != 'http': if host[:4] != 'http':
+1 -1
View File
@@ -123,6 +123,7 @@ def load_cookies(alfa_s=False):
os.remove(cookies_file) os.remove(cookies_file)
cookies_lock.release() cookies_lock.release()
load_cookies()
def save_cookies(alfa_s=False): def save_cookies(alfa_s=False):
cookies_lock.acquire() cookies_lock.acquire()
@@ -255,7 +256,6 @@ def downloadpage(url, **opt):
""" """
url = scrapertools.unescape(url) url = scrapertools.unescape(url)
load_cookies()
domain = urlparse.urlparse(url).netloc domain = urlparse.urlparse(url).netloc
global domainCF global domainCF
CF = False CF = False
+2 -1
View File
@@ -387,7 +387,8 @@ def scrape(func):
if not data: if not data:
page = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True) page = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True)
# if url may be changed and channel has findhost to update # 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']() host = func.__globals__['findhost']()
parse = list(urlparse.urlparse(item.url)) parse = list(urlparse.urlparse(item.url))
from core import jsontools from core import jsontools
+18 -10
View File
@@ -18,6 +18,8 @@ PLUGIN_NAME = "kod"
__settings__ = xbmcaddon.Addon(id="plugin.video." + PLUGIN_NAME) __settings__ = xbmcaddon.Addon(id="plugin.video." + PLUGIN_NAME)
__language__ = __settings__.getLocalizedString __language__ = __settings__.getLocalizedString
__version_fix = None
__dev_mode = None
channels_data = list() channels_data = list()
@@ -36,19 +38,25 @@ def get_addon_version(with_fix=True):
def get_addon_version_fix(): def get_addon_version_fix():
if not dev_mode(): global __version_fix
try: ret = __version_fix
sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline() if not ret:
return sha[:7] if not dev_mode():
except: try:
return '??' sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline()
else: ret = sha[:7]
return 'DEV' except:
ret = '??'
else:
ret = 'DEV'
return ret
def dev_mode(): def dev_mode():
r = os.path.isdir(get_runtime_path() + '/.git') global __dev_mode
return r if not __dev_mode:
__dev_mode = os.path.isdir(get_runtime_path() + '/.git')
return __dev_mode
def get_platform(full_version=False): def get_platform(full_version=False):
+1 -1
View File
@@ -12,7 +12,7 @@ def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url) logger.info("(page_url='%s')" % page_url)
if 'http://' in page_url: # fastids 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]+)') page_url = scrapertools.find_single_match(page_url, 'backin.net/([a-zA-Z0-9]+)')
global data global data
data = httptools.downloadpage("http://backin.net/stream-%s-500x400.html" % page_url).data data = httptools.downloadpage("http://backin.net/stream-%s-500x400.html" % page_url).data
+1 -1
View File
@@ -24,7 +24,7 @@ def test_video_exists(page_url):
page_url = resp.url page_url = resp.url
if '/streaming.php' in page_url in page_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) # logger.info('WCODE=' + code)
page_url = 'https://wstream.video/video.php?file_code=' + code page_url = 'https://wstream.video/video.php?file_code=' + code
data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True).data data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True).data
+1 -1
View File
@@ -51,7 +51,7 @@ def mainlist(item):
logger.info() logger.info()
itemlist = [] itemlist = []
list_canales, any_active = get_channels_list() # list_canales, any_active = get_channels_list()
channel_language = config.get_setting("channel_language", default="auto") channel_language = config.get_setting("channel_language", default="auto")
if channel_language == 'auto': if channel_language == 'auto':
channel_language = auto_filter() channel_language = auto_filter()
+1 -1
View File
@@ -1892,7 +1892,7 @@ def newlist(item):
# Creación de nueva lista en filmaffinity # Creación de nueva lista en filmaffinity
itemlist = [] itemlist = []
if item.accion == "lista": 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 data = httptools.downloadpage("http://m.filmaffinity.com" + location).data
itemlist.append(item.clone(action="", title=config.get_localized_string(70338))) itemlist.append(item.clone(action="", title=config.get_localized_string(70338)))
else: else: