fix hdmario con supporto autenticazione mail
This commit is contained in:
10
lib/jsunpack_js2py.py
Normal file
10
lib/jsunpack_js2py.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
from lib import js2py
|
||||
import re
|
||||
|
||||
def unpack(source):
|
||||
fun, data = re.match("""eval\((function\(p,a,c,k,e,d\){.*?})\((['"].*?)\)\)$""", source.strip(), re.MULTILINE).groups()
|
||||
funPy = js2py.eval_js(fun)
|
||||
return eval('funPy(' + data + ')')
|
||||
|
||||
57
lib/onesecmail.py
Normal file
57
lib/onesecmail.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
|
||||
from core import httptools
|
||||
from platformcode import platformtools, config
|
||||
|
||||
baseUrl = 'https://www.1secmail.com/api/v1/'
|
||||
defDomain = '1secmail.com'
|
||||
|
||||
def splitMail(mail):
|
||||
if '@' in mail:
|
||||
user, domain = mail.split('@')
|
||||
else:
|
||||
user = mail
|
||||
domain = defDomain
|
||||
return user, domain
|
||||
|
||||
def getMessages(mail):
|
||||
"""
|
||||
:param user: user@1secmail.com
|
||||
:return: json containing inbox id and subjects
|
||||
"""
|
||||
user, domain = splitMail(mail)
|
||||
apiUrl = baseUrl + '?action=getMessages&login=' + user + '&domain=' + domain
|
||||
return httptools.downloadpage(apiUrl).json
|
||||
|
||||
|
||||
def readLastMessage(mail):
|
||||
user, domain = splitMail(mail)
|
||||
try:
|
||||
id = getMessages(mail)[0]['id']
|
||||
except:
|
||||
return None
|
||||
apiUrl = baseUrl + '?action=readMessage&login=' + user + '&domain=' + domain + '&id=' + str(id)
|
||||
return httptools.downloadpage(apiUrl).json
|
||||
|
||||
|
||||
def waitForMail(mail, timeout=50):
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000),
|
||||
'verifica tramite mail richiesta dal sito, sono in attesa di nuove mail sulla casella ' + mail)
|
||||
secs = 0
|
||||
while secs < timeout:
|
||||
msg = readLastMessage(mail)
|
||||
if msg:
|
||||
dialog.close()
|
||||
return msg
|
||||
else:
|
||||
time.sleep(1)
|
||||
secs += 1
|
||||
if dialog.iscanceled():
|
||||
break
|
||||
return None
|
||||
|
||||
def getRandom(len=10):
|
||||
letters = string.ascii_lowercase
|
||||
return ''.join(random.choice(letters) for i in range(len)) + '@' + defDomain
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "http://www.drtuber.com/embed/([0-9]+)",
|
||||
"url": "\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "drtuber",
|
||||
"name": "drtuber",
|
||||
"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": ""
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
|
||||
def get_video_url(page_url, video_password):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
url = "https://www.drtuber.com/player_config_json/?vid=%s&aid=0&domain_id=0&embed=0&ref=null&check_speed=0" %page_url
|
||||
data = httptools.downloadpage(url).data
|
||||
data = scrapertools.find_single_match(data, '"files":(.*?)"quality"')
|
||||
patron = '"([lh])q":"([^"]+)"'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for quality, scrapedurl in matches:
|
||||
url = scrapedurl.replace("\/", "/")
|
||||
if "l" in quality: quality = "360"
|
||||
if "h" in quality: quality = "720"
|
||||
video_urls.append(["[drtuber] %s" %quality, url])
|
||||
return video_urls
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "https?://hdmario.live/embed/([0-9]+)",
|
||||
"url": "https://hdmario.live/embed/\\1?"
|
||||
"url": "https://hdmario.live/embed/\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import xbmc
|
||||
|
||||
from core import httptools, scrapertools, filetools
|
||||
from platformcode import logger, config
|
||||
@@ -7,23 +8,45 @@ 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
|
||||
global page, data
|
||||
|
||||
page = httptools.downloadpage(page_url)
|
||||
data = page.data
|
||||
logger.info(page.url)
|
||||
|
||||
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=""):
|
||||
global page, data
|
||||
page_url = page_url.replace('?', '')
|
||||
logger.info("url=" + page_url)
|
||||
global data
|
||||
if 'unconfirmed' in page.url:
|
||||
from lib import onesecmail
|
||||
id = page_url.split('/')[-1]
|
||||
mail = onesecmail.getRandom()
|
||||
postData = {
|
||||
'email': mail,
|
||||
'hls_video_id': id
|
||||
}
|
||||
httptools.downloadpage(page.url, post=postData)
|
||||
jsonMail = onesecmail.waitForMail(mail)
|
||||
logger.info(jsonMail)
|
||||
if jsonMail:
|
||||
code = jsonMail['subject'].split(' - ')[0]
|
||||
page = httptools.downloadpage(page_url + '?code=' + code)
|
||||
data = page.data
|
||||
logger.info(data)
|
||||
from lib import jsunpack_js2py
|
||||
unpacked = jsunpack_js2py.unpack(scrapertools.find_single_match(data, '<script type="text/javascript">\n*\s*\n*(eval.*)'))
|
||||
# p,a,c,k,e,d data -> xhr.setRequestHeader
|
||||
global secureProof, server
|
||||
secureProof = scrapertools.find_single_match(data, '\|(\w{22})\|')
|
||||
secureProof = scrapertools.find_single_match(unpacked, """X-Secure-Proof['"]\s*,\s*['"]([^"']+)""")
|
||||
logger.info('X-Secure-Proof=' + secureProof)
|
||||
|
||||
data = httptools.downloadpage(baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', '') + '.m3u8', headers=[['X-Secure-Proof', secureProof]]).data
|
||||
filetools.write('special://temp/hdmario.m3u8', data, 'w')
|
||||
filetools.write(xbmc.translatePath('special://temp/hdmario.m3u8'), data, 'w')
|
||||
|
||||
video_urls = [['.m3u8 [HDmario]', 'special://temp/hdmario.m3u8']]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user