Files
addon/channels/filmpertutti.py
marco b4376525de KoD 0.7
- nuovo metodo di override DNS
- aggiunta opzione nascondi server, se usi l'autoplay
- migliorie al codice e fix vari
2020-01-08 19:19:59 +01:00

179 lines
5.9 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
# ------------------------------------------------------------
"""
Questi sono commenti per i beta-tester.
Su questo canale, nella categoria 'Ricerca Globale'
non saranno presenti le voci 'Aggiungi alla Videoteca'
e 'Scarica Film'/'Scarica Serie', dunque,
la loro assenza, nel Test, NON dovrà essere segnalata come ERRORE.
Novità (globale). Indicare in quale/i sezione/i è presente il canale:
- film, serie
- I titoli in questa sezione a gruppi di 20
"""
import re
from core import scrapertools, httptools, support
from core.item import Item
from platformcode import config
host = config.get_channel_url()
headers = [['Referer', host]]
list_servers = ['speedvideo', 'verystream', 'openload', 'streamango', 'wstream', 'akvideo']
list_quality = ['HD', 'SD']
@support.menu
def mainlist(item):
film = ['/category/film/',
('Generi', ['/category/film/', 'genres', 'lettersF'])
]
tvshow = ['/category/serie-tv/',
('Aggiornamenti', ['/aggiornamenti-serie-tv/', 'peliculas', 'newest']),
('Per Lettera', ['/category/serie-tv/', 'genres', 'lettersS'])
]
search = ''
return locals()
@support.scrape
def peliculas(item):
support.log()
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>[^>]+>(?:[\dx]+)\s?(?:[ ]\((?P<lang>[a-zA-Z\-]+)\))?.+?</div>'
pagination = ''
if item.args == 'search':
action = 'select'
elif item.contentType == 'tvshow':
action = 'episodios'
elif item.contentType == 'movie':
action ='findvideos'
else:
action = 'select'
def itemHook(item):
item.title = item.title.replace(r'-', ' ')
return item
return locals()
@support.scrape
def episodios(item):
data = httptools.downloadpage(item.url, headers=headers).data
data = re.sub('\n|\t', ' ', data)
data = re.sub(r'>\s+<', '> <', data)
support.log('SERIES DATA= ',data)
if 'accordion-item' in data:
patronBlock = r'<span class="season[^>]*>(?P<season>\d+)[^>]+>[^>]+>[^>]+>[^>]+>\D*(?:STAGIONE|Stagione)[ -]+(?P<lang>[a-zA-Z\- ]+)[^<]*</span>(?P<block>.*?)<div id="(?:season|disqus)'
patron = r'<img src="(?P<thumb>[^"]+)">.*?<li class="season-no">(?P<episode>.*?)<\/li>(?P<url>.*?javascript:;">(?P<title>[^<]+)<.+?)<\/table>'
else:
# patronBlock = r'<div id="info" class="pad">(?P<block>.*?)<div id="disqus_thread">'
# deflang='Sub-ITA'
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<url>.*?)(?:<br|</p)'
def itemHook(item):
item.title.replace('&#215;','x')
if not item.contentLanguage:
item.contentLanguage = 'ITA'
return item
return locals()
@support.scrape
def genres(item):
if item.args == 'lettersF':
item.contentType = 'movie'
else:
item.contentType = 'tvshow'
action = 'peliculas'
patronBlock = r'<select class="cats">(?P<block>.*?)<\/select>'
patronMenu = r'<option data-src="(?P<url>[^"]+)">(?P<title>.*?)<\/option>'
return locals()
def select(item):
support.log()
data = httptools.downloadpage(item.url, headers=headers).data
patronBlock = scrapertools.find_single_match(data, r'class="taxonomy category" ><span property="name">(.*?)</span></a><meta property="position" content="2">')
if patronBlock.lower() != 'film':
support.log('select = ### è una serie ###')
item.contentType='tvshow'
return episodios(item)
else:
support.log('select = ### è un movie ###')
item.contentType='movie'
return findvideos(item)
def search(item, texto):
support.log()
item.url = host + "/?s=" + texto
item.contentType = 'episode'
item.args = 'search'
try:
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
support.log("%s" % line)
return []
def newest(categoria):
support.log()
itemlist = []
item = Item()
try:
if categoria == "peliculas":
item.url = host + "/category/film/"
item.action = "peliculas"
item.extra = "movie"
item.contentType = 'movie'
itemlist = peliculas(item)
else:
item.url = host + "/aggiornamenti-serie-tv/"
item.action = "peliculas"
item.args = "newest"
item.contentType = 'tvshow'
itemlist = peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
support.log("{0}".format(line))
return []
return itemlist
def findvideos(item):
if item.contentType == 'movie':
data = httptools.downloadpage(item.url).data
toUnshorten = scrapertools.find_multiple_matches(data, 'https?://buckler.link/[a-zA-Z0-9]+')
for link in toUnshorten:
data += '\n' + httptools.downloadpage(link, follow_redirects=False).headers["Location"]
return support.server(item, data=data)
else:
return support.server(item, item.url)