miglioramento debugging e modifiche varie
This commit is contained in:
@@ -38,14 +38,12 @@ blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’
|
|||||||
@support.menu
|
@support.menu
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
findhost()
|
findhost()
|
||||||
film = ''
|
film = [
|
||||||
filmSub = [
|
|
||||||
('HD', ['', 'menu', 'Film HD Streaming']),
|
('HD', ['', 'menu', 'Film HD Streaming']),
|
||||||
('Generi', ['', 'menu', 'Film per Genere']),
|
('Generi', ['', 'menu', 'Film per Genere']),
|
||||||
('Anni', ['', 'menu', 'Film per Anno'])
|
('Anni', ['', 'menu', 'Film per Anno'])
|
||||||
]
|
]
|
||||||
tvshow = '/serietv/'
|
tvshow = ['/serietv/',
|
||||||
tvshowSub = [
|
|
||||||
('Aggiornamenti serie tv', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'last']),
|
('Aggiornamenti serie tv', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'last']),
|
||||||
('Per Lettera', ['/serietv/', 'menu', 'Serie-Tv per Lettera']),
|
('Per Lettera', ['/serietv/', 'menu', 'Serie-Tv per Lettera']),
|
||||||
('Per Genere', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'menu', 'Serie-Tv per Genere']),
|
('Per Genere', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'menu', 'Serie-Tv per Genere']),
|
||||||
@@ -59,8 +57,7 @@ def mainlist(item):
|
|||||||
def menu(item):
|
def menu(item):
|
||||||
findhost()
|
findhost()
|
||||||
patronBlock = item.args + r'<span.*?><\/span>.*?<ul.*?>(.*?)<\/ul>'
|
patronBlock = item.args + r'<span.*?><\/span>.*?<ul.*?>(.*?)<\/ul>'
|
||||||
patron = r'href="?(?P<url>[^">]+)"?>(?P<title>.*?)<\/a>'
|
patronMenu = r'href="?(?P<url>[^">]+)"?>(?P<title>.*?)<\/a>'
|
||||||
thumb = ''
|
|
||||||
action = 'peliculas'
|
action = 'peliculas'
|
||||||
|
|
||||||
return locals()
|
return locals()
|
||||||
@@ -133,13 +130,11 @@ def last(item):
|
|||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
support.log()
|
if '/serietv/' not in item.url:
|
||||||
if item.contentType == 'movie' or '/serietv/' not in item.url:
|
|
||||||
patron = r'<div class="?card-image"?>.*?<img src="?(?P<thumb>[^" ]+)"? alt.*?<a href="?(?P<url>[^" >]+)(?:\/|")>(?P<title>[^<[(]+)(?:\[(?P<quality>[A-Za-z0-9/-]+)])? (?:\((?P<year>[0-9]{4})\))?.*?<strong>(?P<genre>[^<>&]+).*?DURATA (?P<duration>[0-9]+).*?<br(?: /)?>(?P<plot>[^<>]+)'
|
patron = r'<div class="?card-image"?>.*?<img src="?(?P<thumb>[^" ]+)"? alt.*?<a href="?(?P<url>[^" >]+)(?:\/|")>(?P<title>[^<[(]+)(?:\[(?P<quality>[A-Za-z0-9/-]+)])? (?:\((?P<year>[0-9]{4})\))?.*?<strong>(?P<genre>[^<>&]+).*?DURATA (?P<duration>[0-9]+).*?<br(?: /)?>(?P<plot>[^<>]+)'
|
||||||
action = 'findvideos'
|
action = 'findvideos'
|
||||||
else:
|
else:
|
||||||
patron = r'div class="card-image">.*?<img src="(?P<thumb>[^ ]+)" alt.*?<a href="(?P<url>[^ >]+)">(?P<title>[^<[(]+)<\/a>.*?<strong><span style="[^"]+">(?P<genre>[^<>0-9(]+)\((?P<year>[0-9]{4}).*?</(?:p|div)>(?P<plot>.*?)</div'
|
patron = r'div class="card-image">.*?<img src="(?P<thumb>[^ ]+)" alt.*?<a href="(?P<url>[^ >]+)">(?P<title>[^<[(]+)<\/a>.*?<strong><span style="[^"]+">(?P<genre>[^<>0-9(]+)\((?P<year>[0-9]{4}).*?</(?:p|div)>(?P<plot>.*?)</div'
|
||||||
listGroups = ['thumb', 'url', 'title', 'genre', 'year', 'plot']
|
|
||||||
action = 'episodios'
|
action = 'episodios'
|
||||||
|
|
||||||
patronBlock=[r'<div class="?sequex-page-left"?>(.*?)<aside class="?sequex-page-right"?>',
|
patronBlock=[r'<div class="?sequex-page-left"?>(.*?)<aside class="?sequex-page-right"?>',
|
||||||
|
|||||||
+1
-13
@@ -31,18 +31,6 @@ def mainlist(item):
|
|||||||
|
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
def search(item, texto):
|
|
||||||
logger.info("[toonitalia.py] " + item.url + " search " + texto)
|
|
||||||
item.url = host + "/?s=" + texto
|
|
||||||
item.args = 'search'
|
|
||||||
try:
|
|
||||||
return peliculas(item)
|
|
||||||
|
|
||||||
except:
|
|
||||||
import sys
|
|
||||||
for line in sys.exc_info():
|
|
||||||
logger.error("%s" % line)
|
|
||||||
return []
|
|
||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
@@ -78,6 +66,7 @@ def check(item):
|
|||||||
itemlist = episodios(item)
|
itemlist = episodios(item)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
anime = True
|
anime = True
|
||||||
@@ -93,4 +82,3 @@ def episodios(item):
|
|||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
return support.server(item, item.url if item.contentType != 'movie' else httptools.downloadpage(item.url, headers=headers).data )
|
return support.server(item, item.url if item.contentType != 'movie' else httptools.downloadpage(item.url, headers=headers).data )
|
||||||
|
|
||||||
+22
-19
@@ -94,6 +94,8 @@ def color(text, color):
|
|||||||
|
|
||||||
def search(channel, item, texto):
|
def search(channel, item, texto):
|
||||||
log(item.url + " search " + texto)
|
log(item.url + " search " + texto)
|
||||||
|
if 'findhost' in dir(channel):
|
||||||
|
channel.findhost()
|
||||||
item.url = channel.host + "/?s=" + texto
|
item.url = channel.host + "/?s=" + texto
|
||||||
try:
|
try:
|
||||||
return channel.peliculas(item)
|
return channel.peliculas(item)
|
||||||
@@ -106,9 +108,10 @@ def search(channel, item, texto):
|
|||||||
|
|
||||||
|
|
||||||
def dbg():
|
def dbg():
|
||||||
import webbrowser
|
|
||||||
webbrowser.open('http://localhost:5555')
|
|
||||||
import web_pdb;
|
import web_pdb;
|
||||||
|
if not web_pdb.WebPdb.active_instance:
|
||||||
|
import webbrowser
|
||||||
|
webbrowser.open('http://localhost:5555')
|
||||||
web_pdb.set_trace()
|
web_pdb.set_trace()
|
||||||
|
|
||||||
|
|
||||||
@@ -122,18 +125,18 @@ def regexDbg(item, patron, headers, data=''):
|
|||||||
html = re.sub('\n|\t', ' ', html)
|
html = re.sub('\n|\t', ' ', html)
|
||||||
else:
|
else:
|
||||||
html = data
|
html = data
|
||||||
headers = {'content-type': 'application/json'}
|
headers = {'content-type': 'application/json'}
|
||||||
data = {
|
data = {
|
||||||
'regex': patron,
|
'regex': patron,
|
||||||
'flags': 'gm',
|
'flags': 'gm',
|
||||||
'testString': html,
|
'testString': html,
|
||||||
'delimiter': '"',
|
'delimiter': '"',
|
||||||
'flavor': 'python'
|
'flavor': 'python'
|
||||||
}
|
}
|
||||||
r = urllib2.Request(url + '/api/regex', json.dumps(data), headers=headers)
|
r = urllib2.Request(url + '/api/regex', json.dumps(data), headers=headers)
|
||||||
r = urllib2.urlopen(r).read()
|
r = urllib2.urlopen(r).read()
|
||||||
permaLink = json.loads(r)['permalinkFragment']
|
permaLink = json.loads(r)['permalinkFragment']
|
||||||
webbrowser.open(url + "/r/" + permaLink)
|
webbrowser.open(url + "/r/" + permaLink)
|
||||||
|
|
||||||
|
|
||||||
def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="",
|
def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="",
|
||||||
@@ -189,11 +192,11 @@ def scrape(func):
|
|||||||
data = args['data'] if 'data' in args else ''
|
data = args['data'] if 'data' in args else ''
|
||||||
patron = args['patron'] if 'patron' in args else args['patronMenu'] if 'patronMenu' in args else ''
|
patron = args['patron'] if 'patron' in args else args['patronMenu'] if 'patronMenu' in args else ''
|
||||||
headers = args['headers'] if 'headers' in args else func.__globals__['headers']
|
headers = args['headers'] if 'headers' in args else func.__globals__['headers']
|
||||||
patron = args['patron'] if 'patron' in args else ''
|
|
||||||
patronNext = args['patronNext'] if 'patronNext' in args else ''
|
patronNext = args['patronNext'] if 'patronNext' in args else ''
|
||||||
patronBlock = args['patronBlock'] if 'patronBlock' in args else ''
|
patronBlock = args['patronBlock'] if 'patronBlock' in args else ''
|
||||||
typeActionDict = args['type_action_dict'] if 'type_action_dict' in args else {}
|
typeActionDict = args['type_action_dict'] if 'type_action_dict' in args else {}
|
||||||
typeContentDict = args['type_content_dict'] if 'type_content_dict' in args else {}
|
typeContentDict = args['type_content_dict'] if 'type_content_dict' in args else {}
|
||||||
|
debug = args['debug'] if 'debug' in args else False
|
||||||
if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20
|
if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20
|
||||||
else: pagination = ''
|
else: pagination = ''
|
||||||
|
|
||||||
@@ -222,7 +225,7 @@ def scrape(func):
|
|||||||
matches = scrapertoolsV2.find_multiple_matches_groups(block, patron)
|
matches = scrapertoolsV2.find_multiple_matches_groups(block, patron)
|
||||||
log('MATCHES =', matches)
|
log('MATCHES =', matches)
|
||||||
|
|
||||||
if 'debug' in args:
|
if debug:
|
||||||
regexDbg(item, patron, headers, block)
|
regexDbg(item, patron, headers, block)
|
||||||
|
|
||||||
known_keys = ['url', 'title', 'title2', 'episode', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere',
|
known_keys = ['url', 'title', 'title2', 'episode', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere',
|
||||||
@@ -572,7 +575,7 @@ def menu(func):
|
|||||||
title = sub + ' italic bold',
|
title = sub + ' italic bold',
|
||||||
url = host + var[0] if len(var) > 0 else '',
|
url = host + var[0] if len(var) > 0 else '',
|
||||||
action = var[1] if len(var) > 1 else 'peliculas',
|
action = var[1] if len(var) > 1 else 'peliculas',
|
||||||
args=var[2] if len(dictUrl[name]) > 2 else '',
|
args=var[2] if len(var) > 2 else '',
|
||||||
contentType= var[3] if len(var) > 3 else 'movie',)
|
contentType= var[3] if len(var) > 3 else 'movie',)
|
||||||
|
|
||||||
# Make MAIN MENU
|
# Make MAIN MENU
|
||||||
@@ -591,7 +594,7 @@ def menu(func):
|
|||||||
title = sub + ' submenu' + typo(title,'_ {}'),
|
title = sub + ' submenu' + typo(title,'_ {}'),
|
||||||
url = host + var[0] if len(var) > 0 else '',
|
url = host + var[0] if len(var) > 0 else '',
|
||||||
action = var[1] if len(var) > 1 else 'peliculas',
|
action = var[1] if len(var) > 1 else 'peliculas',
|
||||||
args=var[2] if len(dictUrl[name]) > 2 else '',
|
args=var[2] if len(var) > 2 else '',
|
||||||
contentType= var[3] if len(var) > 3 else 'movie',)
|
contentType= var[3] if len(var) > 3 else 'movie',)
|
||||||
# add search menu for category
|
# add search menu for category
|
||||||
if 'search' not in args: menuItem(itemlist, filename, 'Cerca ' + title + '… submenu bold', 'search', host, args=name)
|
if 'search' not in args: menuItem(itemlist, filename, 'Cerca ' + title + '… submenu bold', 'search', host, args=name)
|
||||||
@@ -607,7 +610,7 @@ def menu(func):
|
|||||||
title = sub + ' ',
|
title = sub + ' ',
|
||||||
url = host + var[0] if len(var) > 0 else '',
|
url = host + var[0] if len(var) > 0 else '',
|
||||||
action = var[1] if len(var) > 1 else 'peliculas',
|
action = var[1] if len(var) > 1 else 'peliculas',
|
||||||
args=var[2] if len(dictUrl[name]) > 2 else '',
|
args=var[2] if len(var) > 2 else '',
|
||||||
contentType= var[3] if len(var) > 3 else 'movie',)
|
contentType= var[3] if len(var) > 3 else 'movie',)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user