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

View File

@@ -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",

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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':

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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: