ottimizzazione hdpass e server HDmario
This commit is contained in:
@@ -138,5 +138,5 @@ def findvideos(item):
|
||||
support.log('findvideos', item)
|
||||
return support.hdpass_get_servers(item)
|
||||
|
||||
# def play(item):
|
||||
# return support.hdpass_get_url(item)
|
||||
def play(item):
|
||||
return support.hdpass_get_url(item)
|
||||
@@ -37,25 +37,22 @@ def hdpass_get_servers(item):
|
||||
page = httptools.downloadpage(url, CF=False).data
|
||||
mir = scrapertools.find_single_match(page, patron_mir)
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
thL = []
|
||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
||||
log(mir_url)
|
||||
it = 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)
|
||||
thL.append(executor.submit(hdpass_get_url, it))
|
||||
for res in futures.as_completed(thL):
|
||||
if res.result():
|
||||
ret.append(res.result()[0])
|
||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
||||
log(mir_url)
|
||||
it = 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)
|
||||
if not servertools.get_server_parameters(srv.lower()): # do not exists or it's empty
|
||||
it = hdpass_get_url(it)[0]
|
||||
ret.append(it)
|
||||
return ret
|
||||
# Carica la pagina
|
||||
itemlist = []
|
||||
|
||||
42
servers/hdmario.json
Normal file
42
servers/hdmario.json
Normal file
@@ -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": ""
|
||||
}
|
||||
48
servers/hdmario.py
Normal file
48
servers/hdmario.py
Normal file
@@ -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