fix: ilgeniodellostreaming.py

canale finito, da testare
This commit is contained in:
greko17
2019-11-02 00:50:30 +01:00
parent ab739925d0
commit 693e7babca
2 changed files with 123 additions and 130 deletions
+1 -10
View File
@@ -7,14 +7,5 @@
"thumbnail": "https://i.imgur.com/Nsa81r0.png", "thumbnail": "https://i.imgur.com/Nsa81r0.png",
"banner": "https://i.imgur.com/Nsa81r0.png", "banner": "https://i.imgur.com/Nsa81r0.png",
"categories": ["movie", "tvshow", "anime", "vos"], "categories": ["movie", "tvshow", "anime", "vos"],
"settings": [ "settings": []
{
"id": "include_in_newest_anime",
"type": "bool",
"label": "Includi in Novità - Anime",
"default": false,
"enabled": false,
"visible": false
}
]
} }
+122 -120
View File
@@ -6,8 +6,7 @@
""" """
Problemi noti che non superano il test del canale: Alcuni video non si aprono sul sito...
NESSUNO (update 13-9-2019)
Avvisi per il test: Avvisi per il test:
i link per le categorie non sono TUTTI visibili nella pagina del sito: i link per le categorie non sono TUTTI visibili nella pagina del sito:
@@ -22,17 +21,20 @@
genere-> televisione film genere-> televisione film
https://ilgeniodellostreaming.se/genere/televisione-film https://ilgeniodellostreaming.se/genere/televisione-film
Non va abilitato per: Novità -> Serietv e Aggiornamenti nel canale:
Novità -> Anime - le pagine sono di 25 titoli
La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019)
##### note per i dev #########
- La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019)
- in url: film o serietv
""" """
import re import re
from platformcode import logger from core import scrapertoolsV2, httptools, support
from core import scrapertoolsV2, httptools, tmdb, support from core.support import log
from core.support import log, menu, aplay
from core.item import Item from core.item import Item
from platformcode import config from platformcode import config
@@ -49,136 +51,87 @@ def mainlist(item):
support.log(item) support.log(item)
film = ['/film/', film = ['/film/',
('Film Per Categoria',['', 'category', 'genres']), ('Film Per Categoria',['', 'genres', 'genres']),
('Film Per Anno',['', 'category', 'year']), ('Film Per Anno',['', 'genres', 'year']),
('Film Per Lettera',['/film-a-z/', 'category', 'letter']), ('Film Per Lettera',['/film-a-z/', 'genres', 'letter']),
('Popolari',['/trending/?get=movies', 'peliculas', 'populared']), ('Popolari',['/trending/?get=movies', 'peliculas', 'populared']),
('Più Votati', ['/ratings/?get=movies', 'peliculas', 'populared']) ('Più Votati', ['/ratings/?get=movies', 'peliculas', 'populared'])
]
tvshow = ['/serie/',
('Nuovi Episodi', ['/aggiornamenti-serie/', 'newep', 'tvshow']),
('TV Show', ['/tv-show/', 'peliculas', 'showtv', 'tvshow'])
] ]
anime = ['/anime/'] tvshow = ['/serie/',
('Nuovi Episodi', ['/aggiornamenti-serie/', 'peliculas', 'update']),
('Popolari',['/trending/?get=tv', 'peliculas', 'populared']),
('Più Votati', ['/ratings/?get=tv', 'peliculas', 'populared'])
]
anime = ['/anime/'
]
Tvshow = [
('Show TV', ['/tv-show/', 'peliculas', '', 'tvshow'])
]
search = '' search = ''
return locals() return locals()
@support.scrape
def category(item):
log(item)
action='peliculas'
if item.args == 'genres':
patronBlock = r'<div class="sidemenu"><h2>Genere</h2>(?P<block>.*?)/li></ul></div>'
elif item.args == 'year':
patronBlock = r'<div class="sidemenu"><h2>Anno di uscita</h2>(?P<block>.*?)/li></ul></div>'
elif item.args == 'letter':
patronBlock = r'<div class="movies-letter">(?P<block>.*?)<div class="clearfix">'
patron = r'<a(?:.+?)?href="(?P<url>.*?)"[ ]?>(?P<title>.*?)<\/a>'
## debug = True
return locals()
def search(item, texto):
log(texto)
item.url = host + "/?s=" + texto
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):
log(item) log()
## import web_pdb; web_pdb.set_trace()
if item.args == 'search':
if item.action == 'search':
patronBlock = r'<div class="search-page">(?P<block>.*?)<footer class="main">' patronBlock = r'<div class="search-page">(?P<block>.*?)<footer class="main">'
patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\ patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\
'<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>[^>]+>(?P<type>[^<]+)'\ '<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>[^>]+>(?P<type>[^<]+)'\
'<\/span>.*?<a href.*?>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\ '<\/span>.*?<a href.*?>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\
'<\/a>[^>]+>(?:<span class="rating">IMDb\s*(?P<rating>[0-9.]+)<\/span>)?'\ '<\/a>[^>]+>(?:<span class="rating">IMDb\s*(?P<rating>[0-9.]+)<\/span>)?'\
'.+?(?:<span class="year">(?P<year>[0-9]+)<\/span>)?[^>]+>[^>]+><p>(?P<plot>.*?)<\/p>' '.+?(?:<span class="year">(?P<year>[0-9]+)<\/span>)?[^>]+>[^>]+><p>(?P<plot>.*?)<\/p>'
type_content_dict={'movie': ['film'], 'tvshow': ['tv']}
type_action_dict={'findvideos': ['film'], 'episodios': ['tv']}
## elif item.args == 'newest': ## type_content_dict={'movie': ['film'], 'tvshow': ['tv']}
## patronBlock = r'<div class="content"><header><h1>Aggiornamenti Serie</h1>'\ ## type_action_dict={'findvideos': ['film'], 'episodios': ['tv']}
## '</header>(?P<block>.*?)</li></ul></div></div></div>' def itemHook(item):
## patron = r'src="(?P<thumb>[^"]+)".*?href="(?P<url>[^"]+)">[^>]+>(?P<episode>[^<]+)'\ if 'film' not in item.url:
## '<.*?"c">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<.+?<span class='\ item.contentType = 'tvshow'
## '"quality">(\5SUB-ITA|.+?)</span>' item.action = 'episodios'
return item
else:
elif item.args == 'letter': if item.contentType == 'movie':
patron = r'<td class="mlnh-2"><a href="(?P<url>[^"]+)">(?P<title>.+?)'\ endBlock = '</article></div>'
'[ ]?(?:\[(?P<lang>Sub-ITA)\])?<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})\s+<' else:
elif item.args == 'populared': endBlock = '<footer class="main">'
patron = r'<div class="poster"><a href="(?P<url>[^"]+)"><img src='\
'"(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> '\
'(?P<rating>[0-9.]+)<[^>]+>[^>]+>'\
'(?P<quality>[3]?[D]?[H]?[V]?[D]?[/]?[R]?[I]?[P]?)(?:SUB-ITA)?<'\
'[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)(?:[ ]\[(?P<lang>Sub-ITA)\])?<'\
'[^>]+>[^>]+>[^>]+>(?P<year>\d{4})?<'
elif item.args == 'showtv': patronBlock = r'<header><h1>.+?</h1>(?P<block>.*?)'+endBlock
action = 'episodios'
patron = r'<div class="poster"><a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" '\
'alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> (?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>'\
'[^>]+>[^>]+>(?P<title>.+?)<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})?<[^>]+>[^>]+>'\
'[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>.+?)<'
elif item.contentType == 'movie' and item.args != 'genres': if item.contentType == 'movie':
patronBlock = r'<header><h1>Film</h1>(?P<block>.*?)<div class="pagination">' if item.args == 'letter':
patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" '\ patronBlock = r'<table class="table table-striped">(?P<block>.+?)</table>'
'alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div>'\ patron = r'<img src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+><td class="mlnh-2"><a href="(?P<url>[^"]+)">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})\s+<'
'<span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?'\ elif item.args == 'populared':
'<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\ patron = r'<img src="(?P<thumb>[^"]+)" alt="[^"]+">[^>]+>[^>]+>[^>]+>[^>]+>\s+?(?P<rating>\d+.?\d+|\d+)<[^>]+>[^>]+>(?P<quality>[a-zA-Z\-]+)[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<[^>]+>[^>]+>[^>]+>(?P<year>\d+)<'
'<\/a>[^>]+>'\ else:
'[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>'\
'[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div'
elif item.contentType == 'tvshow' or item.args == 'genres': patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div><span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<\/a>[^>]+>[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div'
action = 'episodios' else:
patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img '\ # TVSHOW
'src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> '\ action = 'episodios'
'(?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>'\ if item.args == 'update':
'(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>'\ action = 'findvideos'
'[^>]+>(?P<year>[^<]+)<.*?<div class="texto">(?P<plot>[^<]+)' patron = r'<div class="poster"><img src="(?P<thumb>[^"]+)"[^>]+>[^>]+><a href="(?P<url>[^"]+)">[^>]+>(?P<episode>[\d\-x]+)[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>[^>]+>[^>]+>(?P<quality>[HD]+)?(?:.+?)?/span><p class="serie"'
pagination = 25
## else: def itemHook(item):
## patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\ item.contentType = 'episode'
## '<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>'\ return item
## '[^>]+>(?P<type>[^<]+)<\/span>.*?<a href.*?>(?P<title>[^<]+)'\ else:
## '<\/a>(?P<lang>[^>])+>[^>]+>(?:<span class="rating">IMDb\s*'\ patron = r'<div class="poster">\s?<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> (?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>[^>]+>(?P<year>[^<]+)(?:<.*?<div class="texto">(?P<plot>[^<]+))?'
## '(?P<rating>[0-9.]+)<\/span>)?.*?(?:<span class="year">(?P<year>[0-9]+)'\
## '<\/span>)?[^>]+>[^>]+><p>(?P<plot>.*?)<\/p>'
#### type_content_dict={'movie': ['film'], 'tvshow': ['tv']}
#### type_action_dict={'findvideos': ['film'], 'episodios': ['tv']}
patronNext = '<span class="current">[^<]+<[^>]+><a href="([^"]+)"' patronNext = '<span class="current">[^<]+<[^>]+><a href="([^"]+)"'
## debug = True #support.regexDbg(item, patron, headers)
return locals() #debug = True
@support.scrape
def newep(item):
patron = r'<div class="poster"><img src="(?P<thumb>[^"]+)" alt="(?:.+?)[ ]?'\
'(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?">[^>]+><a href="(?P<url>[^"]+)">'\
'[^>]+>(?P<episode>[^<]+)<[^>]+>[^>]+>[^>]+><span class="c">'\
'(?P<title>.+?)[ ]?(?:\[Sub-ITA\]|)<'
pagination = 10
## debug = True
return locals() return locals()
@@ -195,35 +148,62 @@ def episodios(item):
# debug = True # debug = True
return locals() return locals()
@support.scrape
def genres(item):
log(item)
action='peliculas'
if item.args == 'genres':
patronBlock = r'<div class="sidemenu"><h2>Genere</h2>(?P<block>.*?)/li></ul></div>'
elif item.args == 'year':
item.args = 'genres'
patronBlock = r'<div class="sidemenu"><h2>Anno di uscita</h2>(?P<block>.*?)/li></ul></div>'
elif item.args == 'letter':
patronBlock = r'<div class="movies-letter">(?P<block>.*?)<div class="clearfix">'
patron = r'<a(?:.+?)?href="(?P<url>.*?)"[ ]?>(?P<title>.*?)<\/a>'
## debug = True
return locals()
def search(item, text):
log(text)
itemlist = []
text = text.replace(' ', '+')
item.url = host + "/?s=" + text
try:
item.args = 'search'
return peliculas(item)
except:
import sys
for line in sys.exc_info():
log("%s" % line)
return []
def newest(categoria): def newest(categoria):
log(categoria) log(categoria)
itemlist = [] itemlist = []
item = Item() item = Item()
action = peliculas
if categoria == 'peliculas': if categoria == 'peliculas':
item.contentType = 'movie' item.contentType = 'movie'
item.url = host + '/film/' item.url = host + '/film/'
elif categoria == 'series': elif categoria == 'series':
action = newep item.args = 'update'
#item.args = 'newest'
item.contentType = 'tvshow' item.contentType = 'tvshow'
item.url = host + '/aggiornamenti-serie/' item.url = host + '/aggiornamenti-serie/'
## elif categoria == 'anime': ## elif categoria == 'anime':
## item.contentType = 'tvshow' ## item.contentType = 'tvshow'
## item.url = host + '/anime/' ## item.url = host + '/anime/'
try: try:
item.action = action item.action = 'peliculas'
itemlist = action(item) itemlist = peliculas(item)
if itemlist[-1].action == action:
itemlist.pop()
except: except:
import sys import sys
for line in sys.exc_info(): for line in sys.exc_info():
logger.error("{0}".format(line)) log("{0}".format(line))
return [] return []
return itemlist return itemlist
@@ -232,9 +212,31 @@ def newest(categoria):
def findvideos(item): def findvideos(item):
log() log()
itemlist =[] itemlist =[]
matches, data = support.match(item, '<iframe class="metaframe rptss" src="([^"]+)"[^>]+>',headers=headers) matches, data = support.match(item, '<iframe class="metaframe rptss" src="([^"]+)"[^>]+>',headers=headers)
for url in matches: for url in matches:
html = httptools.downloadpage(url, headers=headers).data html = httptools.downloadpage(url, headers=headers).data
data += str(scrapertoolsV2.find_multiple_matches(html, '<meta name="og:url" content="([^"]+)">')) data += str(scrapertoolsV2.find_multiple_matches(html, '<meta name="og:url" content="([^"]+)">'))
itemlist = support.server(item, data) itemlist = support.server(item, data)
if item.args == 'update':
data = httptools.downloadpage(item.url).data
patron = r'<div class="item"><a href="'+host+'/serietv/([^"\/]+)\/"><i class="icon-bars">'
series = scrapertoolsV2.find_single_match(data, patron)
titles = support.typo(series.upper().replace('-', ' '), 'bold color kod')
goseries = support.typo("Vai alla Serie:", ' bold color kod')
itemlist.append(
Item(channel=item.channel,
title=goseries + titles,
fulltitle=titles,
show=series,
contentType='tvshow',
contentSerieName=series,
url=host+"/serietv/"+series,
action='episodios',
contentTitle=titles,
plot = "Vai alla Serie " + titles + " con tutte le puntate",
))
return itemlist return itemlist