This commit is contained in:
Alhaziel
2020-02-15 18:58:42 +01:00
5 changed files with 40 additions and 31 deletions

View File

@@ -130,6 +130,7 @@ def newest(categoria):
except:
import sys
for line in sys.exc_info():
from platformcode import logger
logger.error("{0}".format(line))
return []
@@ -138,3 +139,6 @@ def newest(categoria):
def findvideos(item):
support.log('findvideos', item)
return support.hdpass_get_servers(item)
def play(item):
return support.hdpass_get_url(item)

View File

@@ -126,3 +126,6 @@ def newest(categoria):
def findvideos(item):
support.log('findvideos ->', item)
return support.hdpass_get_servers(item)
def play(item):
return support.hdpass_get_url(item)

View File

@@ -142,3 +142,6 @@ def findvideos(item):
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])
return support.hdpass_get_servers(item)
def play(item):
return support.hdpass_get_url(item)

View File

@@ -21,19 +21,25 @@ from platformcode import logger, config
from specials import autoplay
def hdpass_get_servers(item):
def get_url(mir_url, srv):
data = httptools.downloadpage(urlparse.urljoin(url, mir_url)).data # .replace('\n', '')
for media_url in scrapertools.find_multiple_matches(data, patron_media):
log("video -> ", res_video)
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))
def get_hosts(url, quality):
ret = []
page = httptools.downloadpage(url).data
log(page)
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
itemlist = []
if 'hdpass' in item.url or 'hdplayer' in item.url:
@@ -51,30 +57,24 @@ def hdpass_get_servers(item):
data = httptools.downloadpage(url).data
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="fake'
patron_media = r'<iframe allowfullscreen custom-src="([^"]+)'
patron_option = r'<a href="([^"]+?)".*?>([^<]+?)</a>'
res = scrapertools.find_single_match(data, patron_res)
itemlist = []
with futures.ThreadPoolExecutor() as executor:
thL = []
for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
if data: # per non riscaricare
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))
thL.append(executor.submit(get_hosts, res_url, res_video))
for res in futures.as_completed(thL):
if res.result():
itemlist.append(res.result())
itemlist.extend(res.result())
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):
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:
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
itemList = servertools.find_video_items(data=str(data))
itemlist = itemlist + itemList
if data:
itemList = servertools.find_video_items(data=str(data))
itemlist = itemlist + itemList
verifiedItemlist = []
for videoitem in itemlist:
if not videoitem.server:

View File

@@ -2,14 +2,14 @@
from core import httptools
from core import scrapertools
from platformcode import logger
from platformcode import logger, config
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).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, ""