tantifilm: patch per velocizzare ricerca
This commit is contained in:
+50
-50
@@ -75,30 +75,6 @@ def peliculas(item):
|
|||||||
if item.args != 'all' and item.args != 'search':
|
if item.args != 'all' and item.args != 'search':
|
||||||
action = 'findvideos' if item.extra == 'movie' else 'episodios'
|
action = 'findvideos' if item.extra == 'movie' else 'episodios'
|
||||||
item.contentType = 'movie' if item.extra == 'movie' else 'tvshow'
|
item.contentType = 'movie' if item.extra == 'movie' else 'tvshow'
|
||||||
else:
|
|
||||||
def itemHook(item):
|
|
||||||
item.action = 'episodios'
|
|
||||||
item.contentType = 'tvshow'
|
|
||||||
data = httptools.downloadpage(item.url, headers=headers).data
|
|
||||||
data = re.sub('\n|\t', ' ', data)
|
|
||||||
data = re.sub(r'>\s+<', '> <', data)
|
|
||||||
check = scrapertoolsV2.find_single_match(data, r'<div class="category-film">\s+<h3>\s+(.*?)\s+</h3>\s+</div>')
|
|
||||||
if 'sub' in check.lower():
|
|
||||||
item.contentLanguage = 'Sub-ITA'
|
|
||||||
item.title += support.typo('Sub-ITA', '_ [] color kod')
|
|
||||||
support.log("CHECK : ", check)
|
|
||||||
if 'anime' in check.lower():
|
|
||||||
support.log('select = ### è una anime ###')
|
|
||||||
item.action = 'episodios'
|
|
||||||
anime = True
|
|
||||||
args='anime'
|
|
||||||
elif 'serie' in check.lower():
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
support.log('select ELSE = ### è un film ###')
|
|
||||||
item.action = 'findvideos'
|
|
||||||
item.contentType='movie'
|
|
||||||
return item
|
|
||||||
|
|
||||||
#debug = True
|
#debug = True
|
||||||
return locals()
|
return locals()
|
||||||
@@ -107,30 +83,38 @@ def peliculas(item):
|
|||||||
def episodios(item):
|
def episodios(item):
|
||||||
log()
|
log()
|
||||||
findhost()
|
findhost()
|
||||||
|
if not item.data:
|
||||||
data_check = httptools.downloadpage(item.url, headers=headers).data
|
data_check = httptools.downloadpage(item.url, headers=headers).data
|
||||||
data_check = re.sub('\n|\t', ' ', data_check)
|
data_check = re.sub('\n|\t', ' ', data_check)
|
||||||
data_check = re.sub(r'>\s+<', '> <', data_check)
|
data_check = re.sub(r'>\s+<', '> <', data_check)
|
||||||
|
else:
|
||||||
|
data_check = item.data
|
||||||
patron_check = r'<iframe src="([^"]+)" scrolling="no" frameborder="0" width="626" height="550" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">'
|
patron_check = r'<iframe src="([^"]+)" scrolling="no" frameborder="0" width="626" height="550" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">'
|
||||||
item.url = scrapertoolsV2.find_single_match(data_check, patron_check)
|
item.url = scrapertoolsV2.find_single_match(data_check, patron_check)
|
||||||
|
|
||||||
patronBlock = r'Episodio<\/a>.*?<ul class="nav navbar-nav">(?P<block>.*?)<\/ul>'
|
patronBlock = r'Stagioni<\/a>.*?<ul class="nav navbar-nav">(?P<block>.*?)<\/ul>'
|
||||||
patron = r'<a href="(?P<url>[^"]+)"\s*>\s*<i[^>]+><\/i>\s*(?P<episode>\d+)<\/a>'
|
patron = r'<a href="(?P<url>[^"]+)"\s*>\s*<i[^>]+><\/i>\s*(?P<episode>\d+)<\/a>'
|
||||||
|
# debug = True
|
||||||
|
|
||||||
def itemHook(item):
|
def itemlistHook(itemlist):
|
||||||
item.contentType = 'tvshow'
|
retItemlist = []
|
||||||
url_season = item.url.rpartition('/')
|
for item in itemlist:
|
||||||
support.log("ITEM URL: ", url_season[0])
|
item.contentType = 'episode'
|
||||||
seasons = support.match(item, r'<a href="([^"]+)"\s*>\s*<i[^>]+><\/i>\s*(\d+)<\/a>', r'Stagioni<\/a>.*?<ul class="nav navbar-nav">(.*?)<\/ul>', headers=headers, url=url_season[0])[0]
|
|
||||||
for season_url, season in seasons:
|
|
||||||
support.log("ITEM URL2: ", url_season[0],' - ', item.url)
|
|
||||||
if season_url[0] in item.url:
|
|
||||||
item.title = support.typo(season+'x'+unify.remove_format(item.title), 'bold')
|
|
||||||
## item.infoLabels['title'] = item.fulltitle if item.infoLabels['title'] == '' else item.infoLabels['title']
|
|
||||||
## item.infoLabels['tvshowtitle'] = item.fulltitle if item.infoLabels['tvshowtitle'] == '' else item.infoLabels['tvshowtitle']
|
|
||||||
break
|
|
||||||
|
|
||||||
return item
|
season = unify.remove_format(item.title)
|
||||||
|
season_data = httptools.downloadpage(item.url).data
|
||||||
|
season_data = re.sub('\n|\t', ' ', season_data)
|
||||||
|
season_data = re.sub(r'>\s+<', '> <', season_data)
|
||||||
|
block = scrapertoolsV2.find_single_match(season_data, 'Episodi.*?<ul class="nav navbar-nav">(.*?)</ul>')
|
||||||
|
episodes = scrapertoolsV2.find_multiple_matches(block, '<a href="([^"]+)"\s*>\s*<i[^>]+><\/i>\s*(\d+)<\/a>')
|
||||||
|
for url, episode in episodes:
|
||||||
|
i = item.clone()
|
||||||
|
i.action = 'findvideos'
|
||||||
|
i.url = url
|
||||||
|
i.title = str(season) + 'x' + str(episode)
|
||||||
|
retItemlist.append(i)
|
||||||
|
|
||||||
|
return retItemlist
|
||||||
|
|
||||||
#debug = True
|
#debug = True
|
||||||
return locals()
|
return locals()
|
||||||
@@ -262,7 +246,23 @@ def findvideos(item):
|
|||||||
## data = item.url
|
## data = item.url
|
||||||
## else:
|
## else:
|
||||||
## data = httptools.downloadpage(item.url, headers=headers).data
|
## data = httptools.downloadpage(item.url, headers=headers).data
|
||||||
data = item.url if item.contentType == "episode" else httptools.downloadpage(item.url, headers=headers).data
|
data = httptools.downloadpage(item.url, headers=headers).data
|
||||||
|
|
||||||
|
data = re.sub('\n|\t', ' ', data)
|
||||||
|
data = re.sub(r'>\s+<', '> <', data)
|
||||||
|
check = scrapertoolsV2.find_single_match(data, r'<div class="category-film">\s+<h3>\s+(.*?)\s+</h3>\s+</div>')
|
||||||
|
if 'sub' in check.lower():
|
||||||
|
item.contentLanguage = 'Sub-ITA'
|
||||||
|
support.log("CHECK : ", check)
|
||||||
|
if 'anime' in check.lower():
|
||||||
|
item.contentType = 'tvshow'
|
||||||
|
item.data = data
|
||||||
|
support.log('select = ### è una anime ###')
|
||||||
|
return episodios(item)
|
||||||
|
elif 'serie' in check.lower():
|
||||||
|
item.contentType = 'tvshow'
|
||||||
|
item.data = data
|
||||||
|
return episodios(item)
|
||||||
|
|
||||||
if 'protectlink' in data:
|
if 'protectlink' in data:
|
||||||
urls = scrapertoolsV2.find_multiple_matches(data, r'<iframe src="[^=]+=(.*?)"')
|
urls = scrapertoolsV2.find_multiple_matches(data, r'<iframe src="[^=]+=(.*?)"')
|
||||||
@@ -271,13 +271,13 @@ def findvideos(item):
|
|||||||
url = url.decode('base64')
|
url = url.decode('base64')
|
||||||
# tiro via l'ultimo carattere perchè non c'entra
|
# tiro via l'ultimo carattere perchè non c'entra
|
||||||
url, c = unshorten_only(url)
|
url, c = unshorten_only(url)
|
||||||
data += '\t' + url
|
if 'nodmca' in url:
|
||||||
support.log("SONO QUI: ", url)
|
page = httptools.downloadpage(url, headers=headers).data
|
||||||
if 'nodmca' in data:
|
url = '\t' + scrapertoolsV2.find_single_match(page,'<meta name="og:url" content="([^=]+)">')
|
||||||
page = httptools.downloadpage(url, headers=headers).data
|
if url:
|
||||||
url += isturl.add('\t' + scrapertoolsV2.find_single_match(page,'<meta name="og:url" content="([^=]+)">'))
|
listurl.add(url)
|
||||||
|
support.dbg()
|
||||||
return support.server(item, data=listurl)#, headers=headers)
|
return support.server(item, data=listurl if listurl else data)#, headers=headers)
|
||||||
# return itemlist
|
# return itemlist
|
||||||
|
|
||||||
##def findvideos(item):
|
##def findvideos(item):
|
||||||
|
|||||||
@@ -271,20 +271,11 @@ def run(item=None):
|
|||||||
elif item.action == "search":
|
elif item.action == "search":
|
||||||
logger.info("item.action=%s" % item.action.upper())
|
logger.info("item.action=%s" % item.action.upper())
|
||||||
|
|
||||||
last_search = ""
|
last_search = channeltools.get_channel_setting('Last_searched', 'search', '')
|
||||||
last_search_active = config.get_setting("last_search", "search")
|
|
||||||
if last_search_active:
|
|
||||||
try:
|
|
||||||
current_saved_searches_list = list(config.get_setting("saved_searches_list", "search"))
|
|
||||||
last_search = current_saved_searches_list[0]
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
tecleado = platformtools.dialog_input(last_search)
|
tecleado = platformtools.dialog_input(last_search)
|
||||||
if tecleado is not None:
|
if tecleado is not None:
|
||||||
if last_search_active and not tecleado.startswith("http"):
|
channeltools.set_channel_setting('Last_searched', tecleado, 'search')
|
||||||
from specials import search
|
|
||||||
search.save_search(tecleado)
|
|
||||||
|
|
||||||
if 'search' in dir(channel):
|
if 'search' in dir(channel):
|
||||||
itemlist = channel.search(item, tecleado)
|
itemlist = channel.search(item, tecleado)
|
||||||
|
|||||||
Reference in New Issue
Block a user