fix ricerca altadefinizioneclick e registrazione hdmario

This commit is contained in:
marco
2020-11-19 19:21:55 +01:00
parent b80e1dafc6
commit 7c323c309b
3 changed files with 9 additions and 5 deletions

View File

@@ -46,6 +46,7 @@ def mainlist(item):
@support.scrape
def peliculas(item):
# debug = True
patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)".+?<h2 class="titleFilm">[^>]+>'\
r'(?P<title>.+?)[ ]?(?:|\[(?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 ">'

View File

@@ -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

View File

@@ -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')