ottimizzazione hdpass e server HDmario
This commit is contained in:
@@ -138,5 +138,5 @@ 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):
|
def play(item):
|
||||||
# return support.hdpass_get_url(item)
|
return support.hdpass_get_url(item)
|
||||||
+16
-19
@@ -37,25 +37,22 @@ def hdpass_get_servers(item):
|
|||||||
page = httptools.downloadpage(url, CF=False).data
|
page = httptools.downloadpage(url, CF=False).data
|
||||||
mir = scrapertools.find_single_match(page, patron_mir)
|
mir = scrapertools.find_single_match(page, patron_mir)
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||||
thL = []
|
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
||||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
log(mir_url)
|
||||||
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
it = Item(channel=item.channel,
|
||||||
log(mir_url)
|
action="play",
|
||||||
it = Item(channel=item.channel,
|
fulltitle=item.fulltitle,
|
||||||
action="play",
|
quality=quality,
|
||||||
fulltitle=item.fulltitle,
|
show=item.show,
|
||||||
quality=quality,
|
thumbnail=item.thumbnail,
|
||||||
show=item.show,
|
contentType=item.contentType,
|
||||||
thumbnail=item.thumbnail,
|
title=srv,
|
||||||
contentType=item.contentType,
|
server=srv,
|
||||||
title=srv,
|
url= mir_url)
|
||||||
server=srv,
|
if not servertools.get_server_parameters(srv.lower()): # do not exists or it's empty
|
||||||
url= mir_url)
|
it = hdpass_get_url(it)[0]
|
||||||
thL.append(executor.submit(hdpass_get_url, it))
|
ret.append(it)
|
||||||
for res in futures.as_completed(thL):
|
|
||||||
if res.result():
|
|
||||||
ret.append(res.result()[0])
|
|
||||||
return ret
|
return ret
|
||||||
# Carica la pagina
|
# Carica la pagina
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"find_videos": {
|
||||||
|
"ignore_urls": [],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"pattern": "https?://hdmario.live/embed/([0-9]+)",
|
||||||
|
"url": "https://hdmario.live/embed/\\1?"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"free": true,
|
||||||
|
"id": "hdmario",
|
||||||
|
"name": "HDmario",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"default": false,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "black_list",
|
||||||
|
"label": "@60654",
|
||||||
|
"type": "bool",
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": 0,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "favorites_servers_list",
|
||||||
|
"label": "@60655",
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"5"
|
||||||
|
],
|
||||||
|
"type": "list",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thumbnail": ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
from core import httptools, scrapertools
|
||||||
|
from platformcode import logger, config
|
||||||
|
from BaseHTTPServer import BaseHTTPRequestHandler
|
||||||
|
|
||||||
|
baseUrl = 'https://hdmario.live'
|
||||||
|
|
||||||
|
def test_video_exists(page_url):
|
||||||
|
logger.info("(page_url='%s')" % page_url)
|
||||||
|
global data
|
||||||
|
data = httptools.downloadpage(page_url).data
|
||||||
|
if "the page you are looking for could not be found" in data:
|
||||||
|
return False, config.get_localized_string(70449) % "HDmario"
|
||||||
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
|
logger.info("url=" + page_url)
|
||||||
|
global data
|
||||||
|
# p,a,c,k,e,d data -> xhr.setRequestHeader
|
||||||
|
global secureProof, server
|
||||||
|
secureProof = scrapertools.find_single_match(data, '\|(\w{22})\|')
|
||||||
|
logger.info('X-Secure-Proof=' + secureProof)
|
||||||
|
|
||||||
|
from BaseHTTPServer import HTTPServer
|
||||||
|
server = HTTPServer(('localhost', 9017), GetHandler)
|
||||||
|
Thread(target=server.serve_forever).start()
|
||||||
|
|
||||||
|
video_urls = [['.m3u8 [HDmario]', 'http://localhost:9017/master/' + page_url.split('/')[-1].replace('?', '')]]
|
||||||
|
|
||||||
|
return video_urls
|
||||||
|
|
||||||
|
def shutdown():
|
||||||
|
import time
|
||||||
|
time.sleep(1)
|
||||||
|
server.shutdown()
|
||||||
|
|
||||||
|
class GetHandler(BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
global secureProof
|
||||||
|
data = httptools.downloadpage(baseUrl + self.path, headers=[['X-Secure-Proof', secureProof]]).data
|
||||||
|
self.send_response(200)
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(data)
|
||||||
|
Thread(target=shutdown).start()
|
||||||
|
return
|
||||||
Reference in New Issue
Block a user