This commit is contained in:
Alhaziel01
2020-07-31 09:23:39 +02:00
6 changed files with 83 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ from core.item import Item
from platformcode import config
def findhost():
data = support.httptools.downloadpage('https://altadefinizione-nuovo.link/').data
data = support.httptools.downloadpage('https://altadefinizione-nuovo.info/').data
host = support.scrapertools.find_single_match(data, '<div class="elementor-button-wrapper"> <a href="([^"]+)"')
return host

View File

@@ -10,7 +10,7 @@ from core.item import Item
from platformcode import config
def findhost():
page = httptools.downloadpage("https://www.filmpertutti.group/").data
page = httptools.downloadpage("https://filmpertutti.nuovo.live/").data
url = scrapertools.find_single_match(page, 'Il nuovo indirizzo di FILMPERTUTTI è <a href="([^"]+)')
return url

View File

@@ -64,10 +64,11 @@ def hdpass_get_servers(item):
data = httptools.downloadpage(url, CF=False).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_option = r'<a href="([^"]+?)".*?>([^<]+?)</a>'
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="main-player'
patron_option = r'<a href="([^"]+?)"[^>]+>([^<]+?)</a'
res = scrapertools.find_single_match(data, patron_res)
# dbg()
with futures.ThreadPoolExecutor() as executor:
thL = []

View File

@@ -4,7 +4,7 @@
"ignore_urls": [],
"patterns": [
{
"pattern": "https?://hdmario.live/embed/([0-9]+)",
"pattern": "https?://hdmario.live/\\w+/([0-9]+)",
"url": "https://hdmario.live/embed/\\1"
}
]
@@ -36,6 +36,22 @@
],
"type": "list",
"visible": false
},
{
"default": "",
"enabled": true,
"id": "email",
"label": "email",
"type": "text",
"visible": true
},
{
"default": "",
"enabled": true,
"id": "password",
"label": "password",
"type": "text",
"visible": true
}
]
}

View File

@@ -2,7 +2,7 @@
import xbmc
from core import httptools, scrapertools, filetools
from platformcode import logger, config
from platformcode import logger, config, platformtools
baseUrl = 'https://hdmario.live'
@@ -19,10 +19,58 @@ def test_video_exists(page_url):
return True, ""
def login():
httptools.downloadpage(page.url.replace('/unauthorized', '/login'),
post={'email': config.get_setting('username', server='hdmario'),
'password': config.get_setting('password', server='hdmario')})
def registerOrLogin(page_url, forced=False):
if not forced and config.get_setting('username', server='hdmario') and config.get_setting('password', server='hdmario'):
login()
else:
if platformtools.dialog_yesno('HDmario',
'Questo server necessita di un account, ne hai già uno oppure vuoi tentare una registrazione automatica?',
yeslabel='Accedi', nolabel='Tenta registrazione'):
from specials import setting
from core.item import Item
setting.server_config(Item(config='hdmario'))
login()
else:
logger.info('Registrazione automatica in corso')
import random
import string
randEmail = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(random.randint(9, 14))) + '@gmail.com'
randPsw = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(10))
logger.info('email: ' + randEmail)
logger.info('pass: ' + randPsw)
nTry = 0
while nTry < 5:
nTry += 1
rq = 'loggedin' in httptools.downloadpage(baseUrl + '/register/',
post={'email': randEmail, 'email_confirmation': randEmail,
'password': randPsw,
'password_confirmation': randPsw}).url
if rq:
from core import support
support.dbg()
config.set_setting('username', randEmail, server='hdmario')
config.set_setting('password', randPsw, server='hdmario')
platformtools.dialog_ok('HDmario',
'Registrato automaticamente con queste credenziali:\nemail:' + randEmail + '\npass: ' + randPsw)
break
else:
platformtools.dialog_ok('HDmario', 'Impossibile registrarsi automaticamente')
logger.info('Registrazione completata')
global page, data
page = httptools.downloadpage(page_url)
data = page.data
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)
if 'unconfirmed' in page.url:
from lib import onesecmail
id = page_url.split('/')[-1]
@@ -38,6 +86,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
code = jsonMail['subject'].split(' - ')[0]
page = httptools.downloadpage(page_url + '?code=' + code)
data = page.data
if '/unauthorized' in page.url:
registerOrLogin(page_url)
if 'Registrati' in data:
platformtools.dialog_ok('HDmario', 'Username/password non validi')
registerOrLogin(page_url, True)
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.*)'))

View File

@@ -4,7 +4,7 @@
# you can pass specific channel name using KOD_TST_CH environment var
# export PYTHONPATH=/home/user/.kodi/addons/plugin.video.kod
# export KOD_TST_CH = channel
# export KOD_TST_CH=channel
# python tests/test_generic.py
import os
@@ -87,9 +87,6 @@ chNumRis = {
'Film': 24,
'Serie TV': 24,
},
'guardaSerie TVclick': {
'da controllare': 0
},
'hd4me': {
'Film': 10
},
@@ -206,7 +203,7 @@ class GenericChannelTest(unittest.TestCase):
@parameterized.parameterized_class(
[{'ch': ch['ch'], 'title': title, 'itemlist': itemlist, 'serversFound': ch['serversFound'][title] if title in ch['serversFound'] else True} for ch in channels for
[{'ch': ch['ch'], 'title': title, 'itemlist': itemlist, 'serversFound': ch['serversFound'][title] if title in ch['serversFound'] else True, 'module': ch['module']} for ch in channels for
title, itemlist in ch['menuItemlist'].items()])
class GenericChannelMenuItemTest(unittest.TestCase):
def test_menu(self):
@@ -220,7 +217,9 @@ class GenericChannelMenuItemTest(unittest.TestCase):
if content in self.title:
risNum = len([i for i in itemlist if not i.nextPage]) # not count nextpage
self.assertEqual(chNumRis[self.ch][content], risNum,
'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results')
'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results\n'
+ str(chNumRis[self.ch][content]) + ' but should be ' + str(risNum) + '\n' +
'\n'.join([i.title for i in itemlist if not i.nextPage]))
break
for resIt in itemlist: