From 43504da41d7873f03c038fdbea8236e8fd18ab05 Mon Sep 17 00:00:00 2001 From: marco <10120390+mac12m99@users.noreply.github.com> Date: Thu, 19 Nov 2020 19:21:55 +0100 Subject: [PATCH] fix ricerca altadefinizioneclick e registrazione hdmario --- channels/altadefinizioneclick.py | 4 ++-- lib/fakeMail.py | 7 +++++-- servers/hdmario.py | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index 535e8ff9..66281a78 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -46,6 +46,7 @@ def mainlist(item): @support.scrape def peliculas(item): + # debug = True patron = r'
[ ]?(?:(?P[^<>]+))?.+?href="(?P[^"]+)".+?src="(?P[^"]+)".+?

[^>]+>'\ r'(?P.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</h2> )' patronBlock = r'h1>(?P<block>.*?)<div class="row ismobile">' @@ -60,8 +61,7 @@ def peliculas(item): r'.+?<h2 class="titleFilm(?:Mobile)?">[^>]+>(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?(IMDB\:[ ](?P<rating>.+?))<' elif item.args == 'search': patronBlock = r'<section id="lastUpdate">(?P<block>.*?)<div class="row ismobile">' - patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:<span class="hd">(?P<quality>[^<]+)<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"'\ - r'[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<[^<]+>(?:.*?IMDB:\s(\2[^<]+)<\/div>)?' + patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:<span class="year">(?P<year>[^<]+)<\/span>)?(?:<span class="hd">(?P<quality>[^<]+)<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)' if not item.args: patronBlock = r'ULTIMI INSERITI(?P<block>.*?)<div class="sliderLastUpdate ismobile ">' diff --git a/lib/fakeMail.py b/lib/fakeMail.py index 4e5f7217..bba46678 100644 --- a/lib/fakeMail.py +++ b/lib/fakeMail.py @@ -1,6 +1,7 @@ import random import string import time +from ast import literal_eval from core import httptools, support from platformcode import platformtools, config, logger @@ -121,11 +122,13 @@ class Gmailnator(Mailbox): inbox = self.inbox() if inbox: self.user, id = support.match(inbox[0]['content'], patron='([^\/]+)\/messageid\/#([a-z0-9]+)').match - #<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 = literal_eval('"""' + html + '"""') logger.debug(html) m = Email() - m.subject, m.date, m.body = support.match(html, patron='<b>([^<]+)<\/b><div>([^<]+)<\/div><hr \/>(.*)').match + # ritorna stringhe raw, devo convertirle per eliminare gli \ in piu + m.subject, m.date, m.body = support.match(html, patron=r'<b>([^<]+)<\\/b><div>([^<]+)<hr \\/>(.*)').match return m return inbox diff --git a/servers/hdmario.py b/servers/hdmario.py index 7252827d..bf50a3cb 100644 --- a/servers/hdmario.py +++ b/servers/hdmario.py @@ -77,7 +77,8 @@ def registerOrLogin(page_url): if reg['email'] == mailbox.address: mail = mailbox.waitForMail() if mail: - checkUrl = scrapertools.find_single_match(mail.body, 'href="([^"]+)">Premi qui') + checkUrl = scrapertools.find_single_match(mail.body, 'href="([^"]+)">Premi qui').replace(r'\/', '/') + logger.debug('CheckURL: ' + checkUrl) httptools.downloadpage(checkUrl) config.set_setting('username', mailbox.address, server='hdmario') config.set_setting('password', randPsw, server='hdmario')