Fix streamlare, streamsb, toonitalia e modifiche interne
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,3 +9,5 @@ __pycache__/
|
||||
.vscode/settings.json
|
||||
bin/
|
||||
lib/abi
|
||||
tests/home/
|
||||
reports/
|
||||
@@ -6,6 +6,7 @@
|
||||
"thumbnail": "1337x.png",
|
||||
"banner": "1337x.png",
|
||||
"categories": ["movie", "tvshow", "torrent"],
|
||||
"not_active": ["include_in_newest"],
|
||||
"settings": [
|
||||
{
|
||||
"id": "itaSearch",
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
"thumbnail": "altadefinizione.png",
|
||||
"banner": "altadefinizione.png",
|
||||
"categories": ["movie", "tvshow", "vos"],
|
||||
"settings": []
|
||||
"settings": [],
|
||||
"not_active": ["include_in_newest"]
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ def newest(categoria):
|
||||
item.contentType = 'tvshow'
|
||||
item.args = 'newest'
|
||||
try:
|
||||
item.url = "%s/aggiornamento-nuovi-episodi/" % host
|
||||
item.url = "%s/aggiornamento-episodi-nuovi/" % host
|
||||
item.action = "peliculas"
|
||||
itemlist = peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
|
||||
@@ -61,7 +61,7 @@ def peliculas(item):
|
||||
# debug = True
|
||||
# search = item.text
|
||||
if item.contentType != 'movie': anime = True
|
||||
action = 'findvideos' if item.contentType == 'movie' else 'episodios'
|
||||
action = 'check'
|
||||
blacklist = ['-Film Animazione disponibili in attesa di recensione ']
|
||||
|
||||
if item.action == 'search':
|
||||
@@ -90,39 +90,25 @@ def peliculas(item):
|
||||
return locals()
|
||||
|
||||
|
||||
def episodios(item):
|
||||
@support.scrape
|
||||
def findepisode(item):
|
||||
actLike = 'episodios'
|
||||
patron = r'>\s*(?:(?P<season>\d+)(?:×|x|×))?(?P<episode>\d+)(?:\s+–\s+)?[ –]+(?P<title2>[^<]+)[ –]+<a (?P<data>.*?)(?:<br|</p)'
|
||||
return locals()
|
||||
|
||||
itemlist = findepisode(item)
|
||||
if not itemlist: itemlist = [item.clone(action='findvideos')]
|
||||
|
||||
if inspect.stack(0)[1][3] not in ['find_episodes']:
|
||||
from platformcode import autorenumber
|
||||
autorenumber.start(itemlist, item)
|
||||
def check(item):
|
||||
itemlist = episodios(item)
|
||||
if not itemlist:
|
||||
itemlist = findvideos(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
@support.scrape
|
||||
def episodios(item):
|
||||
patron = r'>\s*(?:(?P<season>\d+)(?:×|x|×))?(?P<episode>\d+)(?:\s+–\s+)?[ –]+(?P<title2>[^<]+)[ –]+<a (?P<data>.*?)(?:<br|</p)'
|
||||
|
||||
# if inspect.stack(0)[1][3] not in ['find_episodes']:
|
||||
# from platformcode import autorenumber
|
||||
# autorenumber.start(itemlist, item)
|
||||
return locals()
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
servers = []
|
||||
itemlist = []
|
||||
|
||||
if item.data:
|
||||
data = item.data
|
||||
else:
|
||||
data = httptools.downloadpage(item.url, headers=headers).data
|
||||
|
||||
matches =support.match(data, patron='href="([^"]+)[^>]+>([^<\d]+)(\d+p)?').matches
|
||||
if matches:
|
||||
for match in matches:
|
||||
itemlist.append(item.clone(server=match[1].strip().lower(), quality=match[2], url=match[0]))
|
||||
if itemlist:
|
||||
servers = support.server(item, itemlist=itemlist)
|
||||
else:
|
||||
servvers = support.server(item, data=data)
|
||||
servers = support.server(item, data=item.data)
|
||||
return servers
|
||||
|
||||
# return support.server(item, item.data if item.contentType != 'movie' else support.match(item.url, headers=headers).data )
|
||||
@@ -132,4 +118,4 @@ def clean_title(title):
|
||||
title = scrapertools.unescape(title)
|
||||
title = title.replace('_',' ').replace('–','-').replace(' ',' ')
|
||||
title = title.strip(' - ')
|
||||
return title
|
||||
return title
|
||||
|
||||
@@ -506,7 +506,7 @@ def title_unify(title):
|
||||
return u_title.strip()
|
||||
|
||||
|
||||
def girc(page_data, url, co):
|
||||
def girc(page_data, url, co, size='invisible'):
|
||||
"""
|
||||
Code adapted from https://github.com/vb6rocod/utils/
|
||||
Copyright (C) 2019 vb6rocod
|
||||
@@ -518,10 +518,10 @@ def girc(page_data, url, co):
|
||||
hdrs = {'Referer': url}
|
||||
rurl = 'https://www.google.com/recaptcha/api.js'
|
||||
aurl = 'https://www.google.com/recaptcha/api2'
|
||||
key = re.search(r'(?:src="{0}\?.*?render|data-sitekey)="?([^"]+)'.format(rurl), page_data)
|
||||
key = re.search(r"""(?:src="{0}\?.*?render|data-sitekey)=['"]?([^"']+)""".format(rurl), page_data)
|
||||
if key:
|
||||
key = key.group(1)
|
||||
rurl = '{0}?render={1}'.format(rurl, key)
|
||||
# rurl = '{0}?render={1}'.format(rurl, key)
|
||||
page_data1 = httptools.downloadpage(rurl, headers=hdrs).data
|
||||
v = re.findall('releases/([^/]+)', page_data1)[0]
|
||||
rdata = {'ar': 1,
|
||||
@@ -529,7 +529,7 @@ def girc(page_data, url, co):
|
||||
'co': co,
|
||||
'hl': 'it',
|
||||
'v': v,
|
||||
'size': 'invisible',
|
||||
'size': size,
|
||||
'sa': 'submit',
|
||||
'cb': ''.join([random.choice(string.ascii_lowercase + string.digits) for i in range(12)])}
|
||||
page_data2 = httptools.downloadpage('{0}/anchor?{1}'.format(aurl, httptools.urlparse.urlencode(rdata)), headers=hdrs).data
|
||||
|
||||
@@ -306,9 +306,8 @@ def findvideos(item, itemlist=[]):
|
||||
|
||||
itemlist = limitItemlist(itemlist)
|
||||
except Exception as ex:
|
||||
template = "An exception of type %s occured. Arguments:\n%r"
|
||||
message = template % (type(ex).__name__, ex.args)
|
||||
logger.error(" %s" % message)
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
p_dialog.update(100)
|
||||
p_dialog.close()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"ignore_urls": ["https://deltabit.co/api"],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "https://deltabit.co/([A-z0-9]+)",
|
||||
|
||||
@@ -23,17 +23,17 @@ def test_video_exists(page_url):
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
global data, response
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
video_urls = []
|
||||
id = scrapertools.find_single_match(page_url, '/e/(\w+)')
|
||||
post = {"id": id}
|
||||
data = httptools.downloadpage("https://streamlare.com/api/video/stream/get", post=post).data.replace("\\","")
|
||||
matches = scrapertools.find_multiple_matches(data, 'label":"([^"]+).*?file":"([^"]+)')
|
||||
for res, media_url in matches:
|
||||
media_url += "|User-Agent=%s" %(httptools.get_user_agent())
|
||||
matches = scrapertools.find_multiple_matches(data, 'file":"([^"]+)')
|
||||
for media_url in matches:
|
||||
media_url += "|User-Agent=%s" % (httptools.get_user_agent())
|
||||
video_urls.append(["MP4", media_url])
|
||||
return video_urls
|
||||
|
||||
|
||||
def get_filename(page_url):
|
||||
from core import jsontools
|
||||
file = jsontools.load(scrapertools.decodeHtmlentities(httptools.downloadpage(page_url).data.split(':file="')[1].split('"')[0]))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "(?:streamsb|sbembed|sbembed1|sbplay1|sbplay|pelistop|tubesb|playersb|embedsb|watchsb|streamas|sbfast|sbfull|viewsb|sbvideo|cloudemb|sbplay2|japopav|javplaya|ssbstream|sbthe|sbspeed)\\.\\w{2,5}/(?:embed-|d/|e/)?([A-z0-9]+)",
|
||||
"pattern": "(?:streamsb|sbembed|sbembed1|sbplay1|sbplay|pelistop|tubesb|playersb|embedsb|watchsb|streamas|sbfast|sbfull|viewsb|sbvideo|cloudemb|sbplay2|japopav|javplaya|ssbstream|sbthe|sbspeed|sbanh)\\.\\w{2,5}/(?:embed-|d/|e/)?([A-z0-9]+)",
|
||||
"url": "https://streamsb.net/d/\\1"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
dl_url = 'https://{}/dl?op=download_orig&id={}&mode={}&hash={}'
|
||||
|
||||
host = scrapertools.get_domain_from_url(page_url)
|
||||
sources = scrapertools.find_multiple_matches(data, r'download_video([^"]+)[^\d]+\d+x(\d+)')
|
||||
sources = scrapertools.find_multiple_matches(data, r'download_video([^"]+)[^\d]+(\d+)p')
|
||||
hash = scrapertools.find_single_match(data, r"file_id',\s'(\d+)")
|
||||
|
||||
if sources:
|
||||
|
||||
10
tests/run.sh
10
tests/run.sh
@@ -3,10 +3,10 @@ rm tests/home/userdata/addon_data/plugin.video.kod/settings_channels/*.json
|
||||
rm tests/home/userdata/addon_data/plugin.video.kod/settings_servers/*.json
|
||||
rm tests/home/userdata/addon_data/plugin.video.kod/cookies.dat
|
||||
rm tests/home/userdata/addon_data/plugin.video.kod/kod_db.sqlite
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install -U sakee
|
||||
pip install -U html-testRunner
|
||||
pip install -U parameterized
|
||||
python3.9 -m pip install --upgrade pip
|
||||
pip3.9 install -U sakee
|
||||
pip3.9 install -U html-testRunner
|
||||
pip3.9 install -U parameterized
|
||||
export PYTHONPATH=$PWD
|
||||
export KODI_INTERACTIVE=0
|
||||
export KODI_HOME=$PWD/tests/home
|
||||
@@ -14,4 +14,4 @@ if (( $# >= 1 ))
|
||||
then
|
||||
export KOD_TST_CH=$1
|
||||
fi
|
||||
python tests/test_generic.py
|
||||
python3.9 tests/test_generic.py
|
||||
@@ -8,7 +8,9 @@
|
||||
# python tests/test_generic.py
|
||||
import html
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import xbmc
|
||||
@@ -53,7 +55,7 @@ import channelselector
|
||||
import re
|
||||
|
||||
|
||||
httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = 60
|
||||
httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = 10
|
||||
|
||||
outDir = os.path.join(os.getcwd(), 'reports')
|
||||
validUrlRegex = re.compile(
|
||||
@@ -142,6 +144,11 @@ chNumRis = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def wait():
|
||||
time.sleep(random.randint(1, 3))
|
||||
|
||||
|
||||
servers = []
|
||||
channels = []
|
||||
|
||||
@@ -152,6 +159,7 @@ results = []
|
||||
logger.record = True
|
||||
for chItem in channel_list:
|
||||
ch = chItem.channel
|
||||
wait()
|
||||
if ch not in chBlackList:
|
||||
hasChannelConfig = False
|
||||
mainlist = []
|
||||
@@ -171,6 +179,7 @@ for chItem in channel_list:
|
||||
error = logger.recordedLog
|
||||
logger.recordedLog = ''
|
||||
for it in mainlist:
|
||||
wait()
|
||||
try:
|
||||
print('preparing ' + ch + ' -> ' + it.title)
|
||||
|
||||
@@ -186,15 +195,18 @@ for chItem in channel_list:
|
||||
else:
|
||||
itemlist = getattr(module, it.action)(it)
|
||||
|
||||
if not firstContent and itemlist and itemlist[0].action in ('findvideos', 'episodios'):
|
||||
# if more search action (ex: movie, tvshow), firstcontent need to be changed in every menu
|
||||
if itemlist and itemlist[0].action in ('findvideos', 'episodios'):
|
||||
firstContent = re.match('[ \w]*', itemlist[0].fulltitle).group(0)
|
||||
|
||||
# some sites might have no link inside, but if all results are without servers, there's something wrong
|
||||
for resIt in itemlist:
|
||||
wait()
|
||||
if resIt.action == 'findvideos' or resIt.action == 'episodios':
|
||||
if hasattr(module, resIt.action):
|
||||
serversFound[it.title] = getattr(module, resIt.action)(resIt)
|
||||
if serversFound[it.title] and resIt.action == 'episodios':
|
||||
wait()
|
||||
serversFound[it.title] = getattr(module, serversFound[it.title][0].action)(serversFound[it.title][0])
|
||||
else:
|
||||
serversFound[it.title] = [resIt]
|
||||
|
||||
Reference in New Issue
Block a user