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