Fix registrazione HDmario

This commit is contained in:
mac12m99
2021-04-18 20:15:31 +02:00
parent da6f697e8d
commit 673dc5c540
3 changed files with 29 additions and 11 deletions
+7 -1
View File
@@ -122,7 +122,13 @@ class Gmailnator(Mailbox):
def readLast(self): def readLast(self):
inbox = self.inbox() inbox = self.inbox()
if inbox: if inbox:
self.user, id = support.match(inbox[0]['content'], patron='([^\/]+)\/messageid\/#([a-z0-9]+)').match for m in inbox:
email = support.match(m['content'], patron='([^\/]+)\/messageid\/#([a-z0-9]+)').match
if email:
break
else:
return
self.user, id = email
#<b>subject<\/b><div>2 minutes ago</div><hr \/><div dir="ltr">body</div> #<b>subject<\/b><div>2 minutes ago</div><hr \/><div dir="ltr">body</div>
html = httptools.downloadpage(self.baseUrl + 'mailbox/get_single_message/', post={'csrf_gmailnator_token': self.csrf, 'action': 'get_message', 'message_id': id, 'email': self.user}).data html = httptools.downloadpage(self.baseUrl + 'mailbox/get_single_message/', post={'csrf_gmailnator_token': self.csrf, 'action': 'get_message', 'message_id': id, 'email': self.user}).data
html = literal_eval('"""' + html + '"""') html = literal_eval('"""' + html + '"""')
+10 -2
View File
@@ -32,6 +32,8 @@ addon_icon = os.path.join( addon.getAddonInfo( "path" ),'resources', 'media', "l
xbmc_player = xbmc.Player() xbmc_player = xbmc.Player()
play_canceled = False
def dialog_ok(heading, message): def dialog_ok(heading, message):
dialog = xbmcgui.Dialog() dialog = xbmcgui.Dialog()
@@ -135,22 +137,25 @@ def dialog_register(heading, user=False, email=False, password=False, user_defau
height += 70 height += 70
else: else:
self.getControl(10003).setVisible(False) self.getControl(10003).setVisible(False)
if self.email: if self.email:
self.getControl(10004).setText(self.email_default) self.getControl(10004).setText(self.email_default)
height += 70 height += 70
else: else:
self.getControl(10004).setVisible(False) self.getControl(10004).setVisible(False)
if self.password: if self.password:
self.getControl(10005).setText(self.password_default) self.getControl(10005).setText(self.password_default)
height += 70 height += 70
else: else:
self.getControl(10005).setVisible(False) self.getControl(10005).setVisible(False)
if self.captcha_img:
if self.captcha_img:
self.getControl(10007).setImage(self.captcha_img) self.getControl(10007).setImage(self.captcha_img)
height += 240 height += 240
else: else:
self.getControl(10005).setVisible(False) self.getControl(10006).setVisible(False)
self.getControl(10007).setVisible(False)
height += 40 height += 40
if height < 250: height = 250 if height < 250: height = 250
self.getControl(10000).setHeight(height) self.getControl(10000).setHeight(height)
@@ -914,6 +919,9 @@ def get_dialogo_opciones(item, default_action, strm, autoplay):
video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing( video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(
item.server, item.url, item.password, muestra_dialogo) item.server, item.url, item.password, muestra_dialogo)
if play_canceled:
return opciones, [], 0, True
seleccion = 0 seleccion = 0
# If you can see the video, present the options # If you can see the video, present the options
if puedes: if puedes:
+12 -8
View File
@@ -36,9 +36,10 @@ def registerOrLogin(page_url):
if login(): if login():
return True return True
if platformtools.dialog_yesno('HDmario', action = platformtools.dialog_yesno('HDmario',
'Questo server necessita di un account, ne hai già uno oppure vuoi tentare una registrazione automatica?', 'Questo server necessita di un account, ne hai già uno oppure vuoi tentare una registrazione automatica?',
yeslabel='Accedi', nolabel='Tenta registrazione'): yeslabel='Accedi', nolabel='Tenta registrazione', customlabel='Annulla')
if action == 1: # accedi
from specials import setting from specials import setting
from core.item import Item from core.item import Item
user_pre = config.get_setting('username', server='hdmario') user_pre = config.get_setting('username', server='hdmario')
@@ -51,24 +52,24 @@ def registerOrLogin(page_url):
return registerOrLogin(page_url) return registerOrLogin(page_url)
else: else:
return [] return []
else: elif action == 0: # tenta registrazione
import random import random
import string import string
logger.debug('Registrazione automatica in corso') logger.debug('Registrazione automatica in corso')
mailbox = Gmailnator() mailbox = Gmailnator()
randPsw = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(10)) randPsw = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(10))
captcha = httptools.downloadpage(baseUrl + '/captchaInfo').json # captcha = httptools.downloadpage(baseUrl + '/captchaInfo').json
logger.debug('email: ' + mailbox.address) logger.debug('email: ' + mailbox.address)
logger.debug('pass: ' + randPsw) logger.debug('pass: ' + randPsw)
reg = platformtools.dialog_register(baseUrl + '/register/', email=True, password=True, email_default=mailbox.address, password_default=randPsw, captcha_img=captcha['captchaUrl']) reg = platformtools.dialog_register(baseUrl + '/register/', email=True, password=True, email_default=mailbox.address, password_default=randPsw)
if not reg: if not reg:
return False return False
regPost = httptools.downloadpage(baseUrl + '/register/', regPost = httptools.downloadpage(baseUrl + '/register/',
post={'email': reg['email'], 'email_confirmation': reg['email'], post={'email': reg['email'], 'email_confirmation': reg['email'],
'password': reg['password'], 'password': reg['password'],
'password_confirmation': reg['password'], 'password_confirmation': reg['password']})
'captchaUuid': captcha['captchaUuid'], # 'captchaUuid': captcha['captchaUuid'],
'captcha': reg['captcha']}) # 'captcha': reg['captcha']})
if '/register' in regPost.url: if '/register' in regPost.url:
error = scrapertools.htmlclean(scrapertools.find_single_match(regPost.data, 'Impossibile proseguire.*?</div>')) error = scrapertools.htmlclean(scrapertools.find_single_match(regPost.data, 'Impossibile proseguire.*?</div>'))
error = scrapertools.unescape(scrapertools.re.sub('\n\s+', ' ', error)) error = scrapertools.unescape(scrapertools.re.sub('\n\s+', ' ', error))
@@ -95,6 +96,8 @@ def registerOrLogin(page_url):
platformtools.dialog_ok('HDmario', 'Hai modificato la mail quindi KoD non sarà in grado di effettuare la verifica in autonomia, apri la casella ' + reg['email'] platformtools.dialog_ok('HDmario', 'Hai modificato la mail quindi KoD non sarà in grado di effettuare la verifica in autonomia, apri la casella ' + reg['email']
+ ' e clicca sul link. Premi ok quando fatto') + ' e clicca sul link. Premi ok quando fatto')
logger.debug('Registrazione completata') logger.debug('Registrazione completata')
else:
return False
return True return True
@@ -122,6 +125,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
if '/unauthorized' in page.url or '/not-active' in page.url: if '/unauthorized' in page.url or '/not-active' in page.url:
httptools.set_cookies({'domain': 'hdmario.live'}, True) # clear cookies httptools.set_cookies({'domain': 'hdmario.live'}, True) # clear cookies
if not registerOrLogin(page_url): if not registerOrLogin(page_url):
platformtools.play_canceled = True
return [] return []
page = httptools.downloadpage(page_url) page = httptools.downloadpage(page_url)
data = page.data data = page.data