fix cb01 serie, vcrypt su kodi 19 e deltabit

episodi serietv ordinati
This commit is contained in:
marco
2020-11-22 15:23:20 +01:00
parent 9b6384e14c
commit 096f8dbfe1
4 changed files with 82 additions and 140 deletions
+46 -51
View File
@@ -127,40 +127,57 @@ def peliculas(item):
@support.scrape @support.scrape
def episodios(item): def episodios(item):
# support.dbg() @support.scrape
data = support.match(item.url, headers=headers).data def folder(item, data):
support.info(data) """
if 'TUTTA LA ' in data: Quando c'è un link ad una cartelle di vcrypt contenente più stagioni
folderUrl = scrapertools.find_single_match(data, r'TUTTA LA \w+\s+(?:&#8211;|-)\s+<a href="?([^" ]+)') """
actLike = 'episodios'
addVideolibrary = False
downloadEnabled = False
folderUrl = scrapertools.find_single_match(data, r'TUTTA LA \w+\s+(?:&#8211;|-)\s+<a href="?([^" ]+)').replace(
'.net/', '.pw/') # vcrypt.pw non ha CF
data = httptools.downloadpage(folderUrl).data data = httptools.downloadpage(folderUrl).data
patron = r'<a href="(?P<url>[^"]+)[^>]+>(?P<title>[^<]+)' patron = r'><a href="(?P<url>[^"]+)[^>]+>(?P<title>[^<]+)'
sceneTitle = True sceneTitle = True
def itemHook(item): def itemHook(item):
item.serieFolder = True item.serieFolder = True
return item return item
else: return locals()
patronBlock = r'(?P<block>sp-head[^>]+>\s*(?:STAGION[EI]\s*(?:DA\s*[0-9]+\s*A)?\s*[0-9]+|MINISERIE) - (?P<lang>[^-<]+)(?:- (?P<quality>[^-<]+))?.*?<\/div>.*?)spdiv[^>]*>'
patron = r'(?:/>|<p>|<strong>)(?P<url>.*?(?P<episode>[0-9]+(?:&#215;|×)[0-9]+)\s*(?P<title2>.*?)?(?:\s*&#8211;|\s*-|\s*<).*?)(?:<\/p>|<br)'
def itemlistHook(itemlist):
title_dict = {}
itlist = []
for item in itemlist:
item.title = re.sub(r'\.(\D)',' \\1', item.title)
match = support.match(item.title, patron=r'(\d+.\d+)').match.replace('x','')
item.order = match
if match not in title_dict:
title_dict[match] = item
elif match in title_dict and item.contentLanguage == title_dict[match].contentLanguage \
or item.contentLanguage == 'ITA' and not title_dict[match].contentLanguage \
or title_dict[match].contentLanguage == 'ITA' and not item.contentLanguage:
title_dict[match].url = item.url
else:
title_dict[match + '1'] = item
for key, value in title_dict.items(): # debug=True
itlist.append(value) data = support.match(item.url, headers=headers).data
folderItemlist = folder(item, data) if 'TUTTA LA ' in data else []
return sorted(itlist, key=lambda it: (it.contentLanguage, int(it.order))) patronBlock = r'(?P<block>sp-head[^>]+>\s*(?:STAGION[EI]\s*(?:DA\s*[0-9]+\s*A)?\s*[0-9]+|MINISERIE) - (?P<lang>[^-<]+)(?:- (?P<quality>[^-<]+))?.*?<\/div>.*?)spdiv[^>]*>'
patron = r'(?:/>|<p>|<strong>)(?P<other>.*?(?P<episode>[0-9]+(?:&#215;|×)[0-9]+)\s*(?P<title2>.*?)?(?:\s*&#8211;|\s*-|\s*<).*?)(?:<\/p>|<br)'
def itemlistHook(itemlist):
title_dict = {}
itlist = []
for i in itemlist:
i.url = item.url
i.title = re.sub(r'\.(\D)',' \\1', i.title)
match = support.match(i.title, patron=r'(\d+.\d+)').match.replace('x','')
i.order = match
if match not in title_dict:
title_dict[match] = i
elif match in title_dict and i.contentLanguage == title_dict[match].contentLanguage \
or i.contentLanguage == 'ITA' and not title_dict[match].contentLanguage \
or title_dict[match].contentLanguage == 'ITA' and not i.contentLanguage:
title_dict[match].url = i.url
else:
title_dict[match + '1'] = i
for key, value in title_dict.items():
itlist.append(value)
itlist = sorted(itlist, key=lambda it: (it.contentLanguage, int(it.order)))
itlist.extend(folderItemlist)
return itlist
return locals() return locals()
@@ -211,32 +228,10 @@ def findvideos(item):
def findvid_serie(item): def findvid_serie(item):
def load_vid_series(html, item, itemlist, blktxt):
support.info('HTML',html)
# Estrae i contenuti
matches = support.match(html, patron=r'<a href=(?:")?([^ "]+)[^>]+>(?!<!--)(.*?)(?:</a>|<img)').matches
for url, server in matches:
item = item.clone(action="play", title=server, url=url, server=server, quality=blktxt)
if 'swzz' in item.url: item.url = support.swzz_get_url(item)
itemlist.append(item)
support.info() support.info()
data = re.sub(r'((?:<p>|<strong>)?[^\d]*\d*(?:&#215;|×)[0-9]+[^<]+)', '', item.other)
itemlist = [] return support.server(item, data=data)
data = re.sub(r'((?:<p>|<strong>)?[^\d]*\d*(?:&#215;|×)[0-9]+[^<]+)', '' ,item.url)
# Blocks with split
blk = re.split(r"(?:>\s*)?([A-Za-z\s0-9]*):\s*<", data, re.S)
blktxt = ""
for b in blk:
if b[0:3] == "a h" or b[0:4] == "<a h":
load_vid_series("<%s>" % b, item, itemlist, blktxt)
blktxt = ""
elif len(b.strip()) > 1:
blktxt = b.strip()
return support.server(item, itemlist=itemlist)
def play(item): def play(item):
+11 -61
View File
@@ -17,7 +17,7 @@ else:
from urllib import urlencode from urllib import urlencode
from time import time from time import time
from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay, scraper
from core.item import Item from core.item import Item
from lib import unshortenit from lib import unshortenit
from platformcode import config from platformcode import config
@@ -391,6 +391,9 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
def html_uniform(data): def html_uniform(data):
"""
replace all ' with " and eliminate newline, so we don't need to worry about
"""
return re.sub("='([^']+)'", '="\\1"', data.replace('\n', ' ').replace('\t', ' ').replace('&nbsp;', ' ')) return re.sub("='([^']+)'", '="\\1"', data.replace('\n', ' ').replace('\t', ' ').replace('&nbsp;', ' '))
@@ -431,6 +434,7 @@ def scrape(func):
lang = args.get('deflang', '') lang = args.get('deflang', '')
sceneTitle = args.get('sceneTitle') sceneTitle = args.get('sceneTitle')
group = args.get('group', False) group = args.get('group', False)
downloadEnabled = args.get('downloadEnabled', True)
pag = item.page if item.page else 1 # pagination pag = item.page if item.page else 1 # pagination
matches = [] matches = []
@@ -438,8 +442,8 @@ def scrape(func):
logger.debug('PATRON= ', patron) logger.debug('PATRON= ', patron)
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)
# replace all ' with " and eliminate newline, so we don't need to worry about data = page.data
data = html_uniform(page.data) data = html_uniform(data)
scrapingTime = time() scrapingTime = time()
if patronBlock: if patronBlock:
if debugBlock: if debugBlock:
@@ -506,6 +510,9 @@ def scrape(func):
if patronNext and inspect.stack()[1][3] not in ['newest']: if patronNext and inspect.stack()[1][3] not in ['newest']:
nextPage(itemlist, item, data, patronNext, function) nextPage(itemlist, item, data, patronNext, function)
if function == 'episodios':
scraper.sort_episode_list(itemlist)
# next page for pagination # next page for pagination
if pagination and len(matches) > pag * pagination and not search: if pagination and len(matches) > pag * pagination and not search:
if inspect.stack()[1][3] not in ['newest','get_newest']: if inspect.stack()[1][3] not in ['newest','get_newest']:
@@ -533,7 +540,7 @@ def scrape(func):
if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): if addVideolibrary and (item.infoLabels["title"] or item.fulltitle):
# item.fulltitle = item.infoLabels["title"] # item.fulltitle = item.infoLabels["title"]
videolibrary(itemlist, item, function=function) videolibrary(itemlist, item, function=function)
if function == 'episodios' or function == 'findvideos': if downloadEnabled and function == 'episodios' or function == 'findvideos':
download(itemlist, item, function=function) download(itemlist, item, function=function)
if 'patronMenu' in args and itemlist: if 'patronMenu' in args and itemlist:
@@ -645,63 +652,6 @@ def dooplay_menu(item, type):
return locals() return locals()
def swzz_get_url(item):
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0'}
# dbg()
if "/link/" in item.url:
data = httptools.downloadpage(item.url, headers=headers).data
if "link =" in data:
data = scrapertools.find_single_match(data, 'link = "([^"]+)"')
if 'http' not in data:
data = 'https:' + data
elif 'linkId = ' in data:
id = scrapertools.find_single_match(data, 'linkId = "([^"]+)"')
data = stayonline(id)
else:
match = scrapertools.find_single_match(data, r'<meta name="og:url" content="([^"]+)"')
match = scrapertools.find_single_match(data, r'URL=([^"]+)">') if not match else match
if not match:
from lib import jsunpack
try:
data = scrapertools.find_single_match(data.replace('\n', ''), r"(eval\s?\(function\(p,a,c,k,e,d.*?)</script>")
data = jsunpack.unpack(data)
logger.debug("##### play /link/ unpack ##\n%s\n##" % data)
except:
logger.debug("##### The content is yet unpacked ##\n%s\n##" % data)
data = scrapertools.find_single_match(data, r'var link(?:\s)?=(?:\s)?"([^"]+)";')
data, c = unshortenit.unwrap_30x_only(data)
else:
data = match
if data.startswith('/'):
data = urlparse.urljoin("http://swzz.xyz", data)
if not "vcrypt" in data:
data = httptools.downloadpage(data).data
logger.debug("##### play /link/ data ##\n%s\n##" % data)
elif 'stayonline.pro' in item.url:
id = item.url.split('/')[-2]
data = stayonline(id)
else:
data = item.url
return data.replace('\\','')
def stayonline(id):
reqUrl = 'https://stayonline.pro/ajax/linkView.php'
p = urlencode({"id": id})
data = httptools.downloadpage(reqUrl, post=p).data
try:
import json
data = json.loads(data)['data']['value']
except:
data = scrapertools.find_single_match(data, r'"value"\s*:\s*"([^"]+)"')
return data
def menuItem(itemlist, filename, title='', action='', url='', contentType='undefined', args=[], style=True): def menuItem(itemlist, filename, title='', action='', url='', contentType='undefined', args=[], style=True):
# Function to simplify menu creation # Function to simplify menu creation
+12 -10
View File
@@ -492,7 +492,6 @@ class UnshortenIt(object):
except Exception as e: except Exception as e:
return uri, str(e) return uri, str(e)
def _unshorten_vcrypt(self, uri): def _unshorten_vcrypt(self, uri):
uri = uri.replace('.net', '.pw') uri = uri.replace('.net', '.pw')
try: try:
@@ -508,15 +507,15 @@ class UnshortenIt(object):
from Crypto.Cipher import AES from Crypto.Cipher import AES
str = str.replace("_ppl_", "+").replace("_eqq_", "=").replace("_sll_", "/") str = str.replace("_ppl_", "+").replace("_eqq_", "=").replace("_sll_", "/")
iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" iv = b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
key = "naphajU2usWUswec" key = b"naphajU2usWUswec"
decoded = b64decode(str) decoded = b64decode(str)
decoded = decoded + '\0' * (len(decoded) % 16) decoded = decoded + b'\0' * (len(decoded) % 16)
crypt_object = AES.new(key, AES.MODE_CBC, iv) crypt_object = AES.new(key, AES.MODE_CBC, iv)
decrypted = '' decrypted = b''
for p in range(0, len(decoded), 16): for p in range(0, len(decoded), 16):
decrypted += crypt_object.decrypt(decoded[p:p + 16]).replace('\0', '') decrypted += crypt_object.decrypt(decoded[p:p + 16]).replace(b'\0', b'')
return decrypted return decrypted.decode('ascii')
if 'shield' in uri.split('/')[-2]: if 'shield' in uri.split('/')[-2]:
uri = decrypt(uri.split('/')[-1]) uri = decrypt(uri.split('/')[-1])
else: else:
@@ -537,7 +536,7 @@ class UnshortenIt(object):
r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False) r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False)
if 'Wait 1 hour' in r.data: if 'Wait 1 hour' in r.data:
uri = '' uri = ''
logger.info('IP bannato da vcrypt, aspetta un ora') logger.error('IP bannato da vcrypt, aspetta un ora')
else: else:
prev_uri = uri prev_uri = uri
uri = r.headers['location'] uri = r.headers['location']
@@ -549,7 +548,11 @@ class UnshortenIt(object):
if 'out_generator' in uri: if 'out_generator' in uri:
uri = re.findall('url=(.*)$', uri)[0] uri = re.findall('url=(.*)$', uri)[0]
elif '/decode/' in uri: elif '/decode/' in uri:
uri = httptools.downloadpage(uri, follow_redirects=True).url scheme, netloc, path, query, fragment = urlsplit(uri)
splitted = path.split('/')
splitted[1] = 'outlink'
uri = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False,
post={'url': splitted[2]}).headers['location']
# uri = decrypt(uri.split('/')[-1]) # uri = decrypt(uri.split('/')[-1])
return uri, r.code if r else 200 return uri, r.code if r else 200
@@ -557,7 +560,6 @@ class UnshortenIt(object):
logger.error(e) logger.error(e)
return uri, 0 return uri, 0
def _unshorten_linkup(self, uri): def _unshorten_linkup(self, uri):
try: try:
r = None r = None
+13 -18
View File
@@ -1,36 +1,31 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import time, sys import time, sys
if sys.version_info[0] >= 3:
import urllib.parse as urllib
else:
import urllib
from core import httptools, scrapertools from core import httptools, scrapertools, support
from lib import jsunpack from lib import jsunpack
from platformcode import logger, config from platformcode import logger, config
def test_video_exists(page_url): def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url) logger.info("(page_url='%s')" % page_url)
global data global data, real_url
data = httptools.downloadpage(page_url).data.replace('"', "'") page = httptools.downloadpage(page_url)
data = page.data.replace('"', "'")
real_url = page.url
if "Not Found" in data or "File Does not Exist" in data: if "Not Found" in data or "File Does not Exist" in data:
return False, config.get_localized_string(70449) % "DeltaBit" return False, config.get_localized_string(70449) % "DeltaBit"
return True, "" return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""): def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("(deltabit page_url='%s')" % page_url) logger.info("(deltabit page_url='%s')" % page_url)
video_urls = [] global data, real_url
global data post = {k: v for k, v in scrapertools.find_multiple_matches(data, "name='([^']+)' value='([^']*)'")}
post = urllib.urlencode({k: v for k, v in scrapertools.find_multiple_matches(data, "name='([^']+)' value='([^']*)'")})
time.sleep(2.5) time.sleep(2.5)
data = httptools.downloadpage(page_url, post=post).data data = httptools.downloadpage(real_url, post=post).data
videos_packed = scrapertools.find_single_match(data, r"</div>\s*<script type='text/javascript'>(eval.function.p,a,c,k,e,.*?)\s*</script>") # videos_packed = scrapertools.find_single_match(data, r"<script type='text/javascript'>(eval.function.p,a,c,k,e,.*?)\s*</script>")
# video_unpacked = jsunpack.unpack(videos_packed)
video_unpacked = jsunpack.unpack(videos_packed) return support.get_jwplayer_mediaurl(data, 'DeltaBit', True)
videos = scrapertools.find_single_match(video_unpacked, r'sources:\["([^"]+)"\]')
video_urls.append([videos.split('.')[-1] + ' [DeltaBit]', videos.replace('https:','http:')])
return video_urls