Files
addon/channels/filmpertutti.py
Alhaziel01 5348eebe19 - Riscritto News
- Finzioni peliculas -> movies, episodios -> episodes
 - Aggiornato sqlitedict
 - fix minori
2021-09-30 19:41:46 +02:00

156 lines
5.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canale per filmpertutti.py
# ------------------------------------------------------------
from core import support
from core.item import Item
from platformcode import config, logger
def findhost(url):
return support.match(url, patron=r'Il nuovo indirizzo di FILMPERTUTTI è ?<a href="([^"]+)').match
host = config.get_channel_url(findhost)
headers = [['Referer', host]]
@support.menu
def mainlist(item):
film = ['/category/film/',
('Generi', ['/category/film/', 'genres', 'lettersF'])
]
tvshow = ['/category/serie-tv/',
('Aggiornamenti', ['/aggiornamenti-serie-tv/', 'movies', 'newest']),
('Per Lettera', ['/category/serie-tv/', 'genres', 'lettersS'])
]
search = ''
return locals()
@support.scrape
def movies(item):
if item.args != 'newest':
patronBlock = r'<ul class="posts">(?P<block>.*)<\/ul>'
patron = r'<li><a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title[^"]*">(?P<title>.+?)(?:\[(?P<lang>Sub-ITA)\])?(?:[ ]\[?(?P<quality>[HD]+)?\])?(?:[ ]\((?P<year>\d+)\)?)?<\/div>'
patronNext = r'<a href="([^"]+)[^>]+>Pagina'
else:
patronBlock = r'<ul class="posts">(?P<block>.*)<div class="clear[^"]*">'
patron = r'<li>\s?<a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title[^"]*">(?P<title>.+?)(?:\s\[(?P<quality>HD)\])?<\/div>\s*<div class="episode[^"]*"[^>]+>(?P<episode>[^<(]+)(?:\((?P<lang>[a-zA-Z\-]+)\))?'
if item.args == 'search':
action = 'check'
elif item.contentType == 'tvshow':
action = 'episodes'
elif item.contentType == 'movie':
action ='findvideos'
else:
action = 'check'
def itemHook(item):
item.title = item.title.replace(' - La Serie', '')
return item
return locals()
@support.scrape
def episodes(item):
# debug=True
data = support.match(item.url, headers=headers).data
if 'accordion-item' in data:
patronBlock = r'<span class="season[^>]*>\d+[^>]+>[^>]+>[^>]+>[^>]+>\D*(?:STAGIONE|Stagione)[ -]+(?P<lang>[a-zA-Z\- ]+)[^<]*</span>(?P<block>.*?)<div id="(?:season|disqus)'
patron = r'data-src="(?P<thumb>[^"]+)"[^>]*>.*?<li class="season-no">(?P<season>\d+)(?:&#215;|×|x)(?P<episode>\d+)[^<0-9]*<\/li>(?P<data>.*?javascript:;">(?P<title>[^<]+).*?</tbody>)'
else:
patronBlock = r'(?:STAGIONE|Stagione)(?:<[^>]+>)?\s*(?:(?P<lang>[A-Za-z- ]+))?(?P<block>.*?)(?:&nbsp;|<strong>|<div class="addtoany)'
patron = r'(?:/>|p>)\s*(?P<season>\d+)(?:&#215;|×|x)(?P<episode>\d+)[^<]+(?P<data>.*?)(?:<br|</p)'
def itemHook(i):
i.url = item.url
i.title.replace('&#215;','x')
if not i.contentLanguage:
i.contentLanguage = 'ITA'
return i
return locals()
@support.scrape
def genres(item):
if item.args == 'lettersF':
item.contentType = 'movie'
else:
item.contentType = 'tvshow'
action = 'movies'
patronBlock = r'<select class="cats">(?P<block>.*?)<\/select>'
patronGenreMenu = r'<option data-src="(?P<url>[^"]+)">(?P<title>[^<]+)<\/option>'
return locals()
def check(item):
logger.debug()
patron=r'class="taxonomy category"\s*><span property="name">([^>]+)</span></a><meta property="position" content="2">'
block = support.match(item.url, patron=patron,headers=headers).match
if block.lower() != 'film':
logger.debug('### è una Serie ###')
item.contentType='tvshow'
return episodes(item)
else:
logger.debug(' ### è un Film ###')
item.contentType='movie'
return findvideos(item)
def search(item, texto):
logger.debug()
item.url = host + "/?s=" + texto
item.args = 'search'
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()
itemlist = []
item = Item()
try:
if category == "movie":
item.url = host + "/category/film/"
item.action = "movies"
item.extra = "movie"
item.contentType = 'movie'
itemlist = movies(item)
else:
item.url = host + "/aggiornamenti-serie-tv/"
item.action = "movies"
item.args = "newest"
item.contentType = 'tvshow'
itemlist = movies(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("{0}".format(line))
return []
return itemlist
def findvideos(item):
if item.contentType == 'movie':
data = support.match(item.url, patron=r'<a target="_blank" rel="nofollow" href="([^"]+)">').matches
return support.server(item, data=data, patronTag='Versione: <[^>]+>([^<]+)')
else:
return support.server(item, item.data)