- Finzioni peliculas -> movies, episodios -> episodes - Aggiornato sqlitedict - fix minori
179 lines
6.5 KiB
Python
179 lines
6.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# ------------------------------------------------------------
|
|
# Canale per altadefinizioneclick
|
|
# ----------------------------------------------------------
|
|
from platformcode import logger
|
|
from core import support
|
|
from core.item import Item
|
|
from platformcode import config
|
|
|
|
def findhost(url):
|
|
data = support.httptools.downloadpage(url).data
|
|
host = support.scrapertools.find_single_match(data, '<div class="elementor-button-wrapper">\s*<a href="([^"]+)"')
|
|
return host
|
|
|
|
host = config.get_channel_url(findhost)
|
|
headers = [['Referer', host]]
|
|
|
|
|
|
@support.menu
|
|
def mainlist(item):
|
|
film = ['',
|
|
('Novità', ['/nuove-uscite/', 'movies', 'news']),
|
|
('Al Cinema', ['/al-cinema/', 'movies', 'cinema']),
|
|
('A-Z',['/lista-film/', 'genres', 'az']),
|
|
('Generi', ['', 'genres', 'genres']),
|
|
('Anni', ['', 'genres', 'years']),
|
|
('Qualità', ['', 'genres', 'quality']),
|
|
('Mi sento Fortunato',[ '', 'genres', 'lucky']),
|
|
('Sub-ITA', ['/sub-ita/', 'movies', 'sub'])
|
|
]
|
|
|
|
tvshow = ['/serie-tv/']
|
|
|
|
search = ''
|
|
return locals()
|
|
|
|
@support.scrape
|
|
def movies(item):
|
|
action = 'check'
|
|
|
|
patron = r'<div class="wrapperImage">\s*(?:<span class="year">(?P<year>[^<]+)[^>]+>)?(?:<span class="hd">(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)".+?<h2 class="titleFilm">[^>]+>(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?</a>.*?(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</div>)'
|
|
|
|
if item.args == 'az':
|
|
patron = r'<img style="[^"]+" src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)" [^>]+>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\]\s*)?<'\
|
|
r'[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+>\s*(?P<quality>[^<]+).*?<span class="label">(?P<ratting>[^<]+)<'
|
|
patronBlock =''
|
|
|
|
elif item.args == 'search':
|
|
patronBlock = r'<section id="lastUpdate">(?P<block>.*?)(?:<div class="row ismobile">|<section)'
|
|
patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:\s*<span class="year">(?P<year>[^<]+)<\/span>)?(?:\s*<span class="hd">(?P<quality>[^<]+)<\/span>)?[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)"(?:(?:[^>]+>){5}\s*(?P<rating>[^<]+))?(?:[^>]+>){4}(?P<title>[^<]+)'
|
|
|
|
if not item.args:
|
|
# patronBlock = r'(?:ULTIMI INSERITI|Serie TV)(?P<block>.*?)</section'
|
|
patronBlock = r'({})(?P<block>.*?)</section'.format('ULTIMI INSERITI' if item.contentType == 'movie' else 'Serie TV')
|
|
# debugBlock = True
|
|
patronNext = r'<a class="next page-numbers" href="([^"]+)">'
|
|
patronTotalPages = r'>(\d+)(?:[^>]+>){3}<a class="next'
|
|
|
|
return locals()
|
|
|
|
@support.scrape
|
|
def genres(item):
|
|
action = 'movies'
|
|
patronGenreMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<'
|
|
|
|
if item.args == 'genres':
|
|
patronBlock = r'<ul class="listSubCat" id="Film">(?P<block>.*)<ul class="listSubCat" id="Anno">'
|
|
elif item.args == 'years':
|
|
patronBlock = r'<ul class="listSubCat" id="Anno">(?P<block>.*)<ul class="listSubCat" id="Qualita">'
|
|
elif item.args == 'quality':
|
|
patronBlock = r'<ul class="listSubCat" id="Qualita">(?P<block>.*)</li>\s*?</ul>\s*?</div>\s*?</div>\s*?</div>\s*?<a'
|
|
elif item.args == 'lucky': # sono i titoli random nella pagina
|
|
patronBlock = r'<h3 class="titleSidebox dado">FILM RANDOM</h3>(?P<block>.*)</section>'
|
|
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<[]+)(?:\[(?P<lang>.+?)\])?<'
|
|
action = 'findvideos'
|
|
elif item.args == 'az':
|
|
blacklist = ['FILM 4K IN STREAMING']
|
|
patron = r'<a title="(?P<title>[^"]+)" href="(?P<url>[^"]+)"'
|
|
item.args = 'az'
|
|
if not item.args == 'az':
|
|
item.args = 'genres'
|
|
|
|
return locals()
|
|
|
|
def search(item, text):
|
|
logger.debug(text)
|
|
|
|
item.args = 'search'
|
|
item.url = host + "?s=" + text
|
|
try:
|
|
return movies(item)
|
|
# Continua la ricerca in caso di errore
|
|
except:
|
|
import sys
|
|
for line in sys.exc_info():
|
|
logger.error("%s" % line)
|
|
return []
|
|
|
|
def newest(category):
|
|
logger.debug(category)
|
|
itemlist = []
|
|
item = Item()
|
|
try:
|
|
if category == "movie":
|
|
item.args = 'news'
|
|
item.contentType = 'movie'
|
|
item.url = host + "/nuove-uscite/"
|
|
item.action = "movies"
|
|
itemlist = movies(item)
|
|
|
|
if itemlist[-1].action == "movies":
|
|
itemlist.pop()
|
|
|
|
# Continua la ricerca in caso di errore
|
|
except:
|
|
import sys
|
|
for line in sys.exc_info():
|
|
from platformcode import logger
|
|
logger.error("{0}".format(line))
|
|
return []
|
|
|
|
return itemlist
|
|
|
|
|
|
def check(item):
|
|
item.contentType = 'tvshow'
|
|
def get_season(pageData, seas_url, season):
|
|
data = ''
|
|
episodes = support.match(pageData if pageData else seas_url, patronBlock=patron_episode, patron=patron_option).matches
|
|
for episode_url, episode in episodes:
|
|
title = season + "x" + episode.zfill(2) + ' - ' + item.fulltitle
|
|
data += title + '|' + episode_url + '\n'
|
|
return data
|
|
|
|
patron_season = '<div class="[^"]+" id="seasonsModal"[^>]+>(.*?)</ul>'
|
|
patron_episode = '<div class="[^"]+" id="episodesModal"[^>]+>(.*?)</ul>'
|
|
patron_option = r'<a href="([^"]+?)".*?>(?:Stagione |Episodio )([^<]+?)</a>'
|
|
|
|
url = support.match(item, patron=r'<iframe id="iframeVid" width="[^"]+" height="[^"]+" src="([^"]+)" allowfullscreen')
|
|
seasons = support.match(url.match, patronBlock=patron_season, patron=patron_option)
|
|
if not seasons.match:
|
|
item.contentType = 'tvshow'
|
|
item.data = url.data
|
|
return findvideos(item)
|
|
|
|
data = ''
|
|
|
|
import sys
|
|
if sys.version_info[0] >= 3: from concurrent import futures
|
|
else: from concurrent_py2 import futures
|
|
with futures.ThreadPoolExecutor() as executor:
|
|
thL = []
|
|
for i, season in enumerate(seasons.matches):
|
|
thL.append(executor.submit(get_season, seasons.data if i == 0 else '', season[0], season[1]))
|
|
for res in futures.as_completed(thL):
|
|
if res.result():
|
|
data += res.result()
|
|
item.data = data
|
|
return episodes(item)
|
|
|
|
@support.scrape
|
|
def episodes(item):
|
|
data = item.data
|
|
|
|
patron = r'(?P<season>\d+)x(?P<episode>\d+)\s*-\s*(?P<title>[^\|]+)\|(?P<url>[^ ]+)'
|
|
action = 'findvideos'
|
|
|
|
def itemlistHook(itemlist):
|
|
itemlist.sort(key=lambda item: (item.infoLabels['season'], item.infoLabels['episode']))
|
|
return itemlist
|
|
|
|
return locals()
|
|
|
|
def findvideos(item):
|
|
logger.debug()
|
|
return support.hdpass_get_servers(item, item.data)
|
|
|
|
|