fix hdpass
This commit is contained in:
@@ -130,6 +130,7 @@ def newest(categoria):
|
|||||||
except:
|
except:
|
||||||
import sys
|
import sys
|
||||||
for line in sys.exc_info():
|
for line in sys.exc_info():
|
||||||
|
from platformcode import logger
|
||||||
logger.error("{0}".format(line))
|
logger.error("{0}".format(line))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -138,3 +139,6 @@ def newest(categoria):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
support.log('findvideos', item)
|
support.log('findvideos', item)
|
||||||
return support.hdpass_get_servers(item)
|
return support.hdpass_get_servers(item)
|
||||||
|
|
||||||
|
def play(item):
|
||||||
|
return support.hdpass_get_url(item)
|
||||||
@@ -126,3 +126,6 @@ def newest(categoria):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
support.log('findvideos ->', item)
|
support.log('findvideos ->', item)
|
||||||
return support.hdpass_get_servers(item)
|
return support.hdpass_get_servers(item)
|
||||||
|
|
||||||
|
def play(item):
|
||||||
|
return support.hdpass_get_url(item)
|
||||||
@@ -142,3 +142,6 @@ def findvideos(item):
|
|||||||
matches = support.match(url,patron=r'<a href="([^"]+)">(\d+)<', patronBlock=r'<h3>EPISODIO</h3><ul>(.*?)</ul>').matches
|
matches = support.match(url,patron=r'<a href="([^"]+)">(\d+)<', patronBlock=r'<h3>EPISODIO</h3><ul>(.*?)</ul>').matches
|
||||||
if matches: item.url = support.urlparse.urljoin(url, matches[-1][0])
|
if matches: item.url = support.urlparse.urljoin(url, matches[-1][0])
|
||||||
return support.hdpass_get_servers(item)
|
return support.hdpass_get_servers(item)
|
||||||
|
|
||||||
|
def play(item):
|
||||||
|
return support.hdpass_get_url(item)
|
||||||
+28
-29
@@ -21,19 +21,25 @@ from platformcode import logger, config
|
|||||||
from specials import autoplay
|
from specials import autoplay
|
||||||
|
|
||||||
def hdpass_get_servers(item):
|
def hdpass_get_servers(item):
|
||||||
def get_url(mir_url, srv):
|
def get_hosts(url, quality):
|
||||||
data = httptools.downloadpage(urlparse.urljoin(url, mir_url)).data # .replace('\n', '')
|
ret = []
|
||||||
for media_url in scrapertools.find_multiple_matches(data, patron_media):
|
page = httptools.downloadpage(url).data
|
||||||
log("video -> ", res_video)
|
log(page)
|
||||||
return Item(channel=item.channel,
|
|
||||||
action="play",
|
|
||||||
fulltitle=item.fulltitle,
|
|
||||||
quality=res_video,
|
|
||||||
show=item.show,
|
|
||||||
thumbnail=item.thumbnail,
|
|
||||||
contentType=item.contentType,
|
|
||||||
url=base64.b64decode(media_url))
|
|
||||||
|
|
||||||
|
mir = scrapertools.find_single_match(page, patron_mir)
|
||||||
|
|
||||||
|
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||||
|
ret.append(Item(channel=item.channel,
|
||||||
|
action="play",
|
||||||
|
fulltitle=item.fulltitle,
|
||||||
|
quality=quality,
|
||||||
|
show=item.show,
|
||||||
|
thumbnail=item.thumbnail,
|
||||||
|
contentType=item.contentType,
|
||||||
|
title=srv,
|
||||||
|
server=srv,
|
||||||
|
url=mir_url))
|
||||||
|
return ret
|
||||||
# Carica la pagina
|
# Carica la pagina
|
||||||
itemlist = []
|
itemlist = []
|
||||||
if 'hdpass' in item.url or 'hdplayer' in item.url:
|
if 'hdpass' in item.url or 'hdplayer' in item.url:
|
||||||
@@ -51,30 +57,24 @@ def hdpass_get_servers(item):
|
|||||||
data = httptools.downloadpage(url).data
|
data = httptools.downloadpage(url).data
|
||||||
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
|
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
|
||||||
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="fake'
|
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="fake'
|
||||||
patron_media = r'<iframe allowfullscreen custom-src="([^"]+)'
|
|
||||||
patron_option = r'<a href="([^"]+?)".*?>([^<]+?)</a>'
|
patron_option = r'<a href="([^"]+?)".*?>([^<]+?)</a>'
|
||||||
|
|
||||||
res = scrapertools.find_single_match(data, patron_res)
|
res = scrapertools.find_single_match(data, patron_res)
|
||||||
|
|
||||||
itemlist = []
|
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
thL = []
|
thL = []
|
||||||
for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
|
for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
|
||||||
if data: # per non riscaricare
|
thL.append(executor.submit(get_hosts, res_url, res_video))
|
||||||
page = data
|
|
||||||
data = ''
|
|
||||||
else:
|
|
||||||
page = httptools.downloadpage(urlparse.urljoin(url, res_url)).data
|
|
||||||
mir = scrapertools.find_single_match(page, patron_mir)
|
|
||||||
|
|
||||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
|
||||||
thL.append(executor.submit(get_url, mir_url, srv))
|
|
||||||
for res in futures.as_completed(thL):
|
for res in futures.as_completed(thL):
|
||||||
if res.result():
|
if res.result():
|
||||||
itemlist.append(res.result())
|
itemlist.extend(res.result())
|
||||||
return server(item, itemlist=itemlist)
|
return server(item, itemlist=itemlist)
|
||||||
|
|
||||||
|
def hdpass_get_url(item):
|
||||||
|
patron_media = r'<iframe allowfullscreen custom-src="([^"]+)'
|
||||||
|
data = httptools.downloadpage(item.url).data
|
||||||
|
item.url = base64.b64decode(scrapertools.find_single_match(data, patron_media))
|
||||||
|
return [item]
|
||||||
|
|
||||||
def color(text, color):
|
def color(text, color):
|
||||||
return "[COLOR " + color + "]" + text + "[/COLOR]"
|
return "[COLOR " + color + "]" + text + "[/COLOR]"
|
||||||
@@ -992,10 +992,9 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
|
|
||||||
if not data and not itemlist:
|
if not data and not itemlist:
|
||||||
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
|
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
|
||||||
|
if data:
|
||||||
itemList = servertools.find_video_items(data=str(data))
|
itemList = servertools.find_video_items(data=str(data))
|
||||||
itemlist = itemlist + itemList
|
itemlist = itemlist + itemList
|
||||||
|
|
||||||
verifiedItemlist = []
|
verifiedItemlist = []
|
||||||
for videoitem in itemlist:
|
for videoitem in itemlist:
|
||||||
if not videoitem.server:
|
if not videoitem.server:
|
||||||
|
|||||||
+2
-2
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
from core import httptools
|
from core import httptools
|
||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
from platformcode import logger
|
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)
|
||||||
data = httptools.downloadpage(page_url).data
|
data = httptools.downloadpage(page_url).data
|
||||||
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, "[Vidto.me] El fichero no existe o ha sido borrado"
|
return False, config.get_localized_string(70292) % 'vidto.me'
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user