Merge remote-tracking branch 'origin/master'

This commit is contained in:
marco
2019-11-03 13:37:27 +01:00
13 changed files with 723 additions and 613 deletions
+267
View File
@@ -0,0 +1,267 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canale per 'cinemalibero'
"""
Questi sono commenti per i beta-tester.
Su questo canale, nelle categorie:
-'Ricerca Globale'
- Novità, voce interna al canale
- Nella lista anime
non saranno presenti le voci:
- 'Aggiungi alla Videoteca'
- 'Scarica Film'/'Scarica Serie',
Inoltre nella lista Anime non è presente la voce rinumerazione!
dunque, la loro assenza, nel Test, NON dovrà essere segnalata come ERRORE.
Novità ( globale ), presenti solo i film:
- film ( 20 titoli ) della pagina https://www.cinemalibero.best/category/film/
Avvisi:
- Eventuali avvisi per i tester
Ulteriori info:
"""
import re
# per l'uso dei decoratori, per i log, e funzioni per siti particolari
from core import support
# se non si fa uso di findhost()
from platformcode import config
# in caso di necessità
from core import scrapertoolsV2, httptools#, servertools
from core.item import Item # per newest
#from lib import unshortenit
# se necessaria la variabile __channel__
# da cancellare se non utilizzata
__channel__ = "cinemalibero"
# da cancellare se si utilizza findhost()
host = config.get_channel_url('cinemalibero')
headers = [['Referer', host]]
list_servers = ['akstream', 'wstream', 'openload', 'streamango']
list_quality = ['default']
### fine variabili
#### Inizio delle def principali ###
@support.menu
def mainlist(item):
support.log(item)
film = ['/category/film/',
('Generi', ['', 'genres', 'genres']),
]
# Voce SERIE, puoi solo impostare l'url
tvshow = ['/category/serie-tv/',
('Novità', ['/aggiornamenti-serie-tv/', 'peliculas', 'update'])
]
# Voce ANIME, puoi solo impostare l'url
Anime = [('Anime', ['/category/anime-giapponesi/', 'peliculas', 'anime', 'tvshow']), # url per la voce Anime, se possibile la pagina con titoli di anime
## #Voce Menu,['url','action','args',contentType]
## ('Novità', ['', '', '']),
## ('In Corso',['', '', '', '']),
## ('Ultimi Episodi',['', '', '', '']),
## ('Ultime Serie',['', '', '', ''])
]
search = ''
return locals()
@support.scrape
def peliculas(item):
support.log(item)
#support.dbg() # decommentare per attivare web_pdb
if item.args == 'search':
patron = r'href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">.+?class="titolo">(?P<title>[^<]+)<'
patronBlock = r'style="color: #2C3549 !important;" class="fon my-3"><small>.+?</small></h1>(?P<block>.*?)<div class="bg-dark ">'
action = 'select'
else:
if item.contentType == 'tvshow':
if item.args == 'update':
patron = r'<div class="card-body p-0">\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">\s<div class="titolo">(?P<title>.+?)(?: &#8211; Serie TV)?(?:\([sSuUbBiItTaA\-]+\))?[ ]?(?P<year>\d{4})?</div>[ ]<div class="genere">(?:[\w]+?\.?\s?[\s|S]?[\dx\-S]+?\s\(?(?P<lang>[iItTaA]+|[sSuUbBiItTaA\-]+)\)?\s?(?P<quality>[HD]+)?|.+?\(?(?P<lang2>[sSuUbBiItTaA\-]+)?\)?</div>)'
action = 'select'
def itemHook(item):
if item.lang2:
if len(item.lang2) <3:
item.lang2 = 'ITA'
item.contentLanguage = item.lang2
item.title += support.typo(item.lang2, '_ [] color kod')
return item
elif item.args == 'anime':# or 'anime' in item.url:
patron = r'<div class="card-body p-0"> <a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?:\([sSuUbBiItTaA\-]+\))?\s?(?:(?P<year>\d{4}|\(\d{4}\)|)?)?<[^>]+>(?:<div class="genere">.+?(?:\()?(?P<lang>ITA|iTA|Sub)(?:\))?)?'
action = 'select'
else:
patron = r'<div class="card-body p-0">\s?<a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</div>(?:<div class="genere">(?:[ |\w]+?(?:[\dx\-]+)?[ ](?:\()?(?P<lang>[sSuUbB]+|[iItTaA]+)(?:\))?\s?(?P<quality>[\w]+)?\s?|[\s|S]?[\dx\-]+\s[|]?\s?(?:[\w]+)?\s?\(?(\4[sSuUbB]+)?\)?)?.+?</div>)?'
action = 'episodios'
elif item.contentType == 'movie':
action = 'findvideos'
patron = r'href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?:\[(?P<lang>Sub-iTA|Sub-ITA|Sub)\])?[ ]\((?P<year>\d+)\)</div>(?:<div class="genere">(?P<quality>[^<]+)<)?'
patronBlock = r'<h1(?: style="color: #2C3549 !important; text-transform: uppercase;"| style="text-transform: uppercase; color: #2C3549 !important;"| style="color: #2C3549 !important; text-transform: uppercase;" style="text-shadow: 1px 1px 1px #FF8C00; color:#FF8C00;"| style="text-shadow: 1px 1px 1px #0f0f0f;" class="darkorange"| style="color:#2C3549 !important;")>.+?</h1>(?P<block>.*?)<div class=(?:"container"|"bg-dark ")>'
patronNext = '<a class="next page-numbers".*?href="([^"]+)">'
## debug = True # True per testare le regex sul sito
return locals()
@support.scrape
def episodios(item):
support.log(item)
#support.dbg()
data = item.data1
if item.args == 'anime':
item.contentType = 'tvshow'
blacklist = ['Clipwatching', 'Verystream', 'Easybytez']
patron = r'(?:href="[ ]?(?P<url>[^"]+)"[^>]+>(?P<title>[^<]+)<|(?P<episode>\d+(?:&#215;|×)?\d+\-\d+|\d+(?:&#215;|×)\d+)[;]?(?:(\4[^<]+)(\2.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>))'
#patron = r'<a target=.+?href="(?P<url>[^"]+)"[^>]+>(?P<title>(Epis|).+?(?P<episode>\d+)?)(?:\((?P<lang>Sub ITA)\))?</a>(?:<br />)?'
patronBlock = r'(?:class="txt_dow">Streaming:(?P<block>.*?)at-below-post)'
else:
patron = r'(?P<episode>\d+(?:&#215;|×)?\d+\-\d+|\d+(?:&#215;|×)\d+)[;]?[ ]?(?:(?P<title>[^<]+)(?P<url>.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>)'
## patron = r'<a target=.+?href="(?P<url>[^"]+)"[^>]+>(?P<title>Epis.+?(\d+)?)(?:\((?P<lang>Sub ITA)\))?</a><br />'
patronBlock = r'<p><strong>(?P<block>(?:.+?[Ss]tagione.+?(?P<lang>iTA|ITA|Sub-ITA|Sub-iTA))?(?:|.+?|</strong>)(/?:</span>)?</p>.*?</p>)'
item.contentType = 'tvshow'
action = 'findvideos'
debug = True
return locals()
@support.scrape
def genres(item):
support.log(item)
#support.dbg()
action = 'peliculas'
#blacklist = ['']
patron = r'<a class="dropdown-item" href="(?P<url>[^"]+)" title="(?P<title>[A-z]+)"'
return locals()
############## Fine ordine obbligato
## Def ulteriori
def select(item):
support.log('select --->', item)
#support.dbg()
data = httptools.downloadpage(item.url, headers=headers).data
block = scrapertoolsV2.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)<div style="margin-left: 0.5%; color: #FFF;">')
if re.findall('rel="category tag">serie', data, re.IGNORECASE):
support.log('select = ### è una serie ###')
return episodios(Item(channel=item.channel,
title=item.title,
fulltitle=item.fulltitle,
url=item.url,
args='serie',
contentType='tvshow',
data1 = data
))
elif re.findall('rel="category tag">anime', data, re.IGNORECASE):
if re.findall('episodio', block, re.IGNORECASE) or re.findall('stagione', data, re.IGNORECASE) or re.findall('numero stagioni', data, re.IGNORECASE):
support.log('select = ### è un anime ###')
return episodios(Item(channel=item.channel,
title=item.title,
fulltitle=item.fulltitle,
url=item.url,
args='anime',
contentType='tvshow',
data1 = data
))
else:
support.log('select = ### è un film ###')
return findvideos(Item(channel=item.channel,
title=item.title,
fulltitle=item.fulltitle,
url=item.url,
args = '',
contentType='movie',
#data = data
))
else:
support.log('select = ### è un film ###')
return findvideos(Item(channel=item.channel,
title=item.title,
fulltitle=item.fulltitle,
url=item.url,
contentType='movie',
#data = data
))
############## Fondo Pagina
# da adattare al canale
def search(item, text):
support.log('search', item)
itemlist = []
text = text.replace(' ', '+')
item.url = host + "/?s=" + text
item.contentType = item.contentType
try:
item.args = 'search'
item.contentType = 'episode' # non fa uscire le voci nel context menu
return peliculas(item)
# Se captura la excepcion, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
support.log('search log:', line)
return []
# da adattare al canale
# inserire newest solo se il sito ha la pagina con le ultime novità/aggiunte
# altrimenti NON inserirlo
def newest(categoria):
support.log('newest ->', categoria)
itemlist = []
item = Item()
try:
if categoria == 'peliculas':
item.url = host+'/category/film/'
item.contentType = 'movie'
## item.action = 'peliculas'
## itemlist = peliculas(item)
elif categoria == 'series':
item.contentType = 'tvshow'
item.args = 'update'
item.url = host+'/aggiornamenti-serie-tv/'
item.action = 'peliculas'
itemlist = peliculas(item)
if itemlist[-1].action == 'peliculas':
itemlist.pop()
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
support.log('newest log: ', {0}.format(line))
return []
return itemlist
#support.server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True)
def findvideos(item):
support.log('findvideos ->', item)
#return support.server(item, headers=headers)
support.log(item)
if item.contentType == 'movie':
return support.server(item)
else:
return support.server(item, data= item.url)
+11 -12
View File
@@ -47,7 +47,7 @@ def mainlist(item):
##
## action = 'episodios'
## block = r'(?P<block>.*?)<div\s+class="btn btn-lg btn-default btn-load-other-series">'
##
##
## if item.args == 'ined':
## deflang = 'SUB-ITA'
## patronBlock = r'<span\s+class="label label-default label-title-typology">'+block
@@ -68,7 +68,7 @@ def mainlist(item):
## elif item.args == 'classic':
## patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-classiche">'+block
## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<'
## pagination = 25
## pagination = 25
## else:
## patronBlock = r'<div\s+class="container container-title-serie-new container-scheda" meta-slug="new">'+block
## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<'
@@ -84,13 +84,13 @@ def peliculas(item):
action = 'episodios'
blacklist = ['DMCA']
if item.args == 'genres' or item.args == 'search':
patronBlock = r'<h2 style="color: white !important" class="title-typology">(?P<block>.+?)<div class="container-fluid whitebg" style="">'
patronBlock = r'<h2 style="color:\s?white !important;?" class="title-typology">(?P<block>.+?)<div class="container-fluid whitebg" style="">'
patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</p>'
patronNext = r'rel="next" href="([^"]+)">'
item.contentType = 'tvshow'
## elif item.args == 'search':
## elif item.args == 'search':
## patronBlock = r'<h2 style="color:\s?white !important.?" class="title-typology">(?P<block>.*?)<div class="container-fluid whitebg" style="">'
## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</p>'
else:
@@ -106,21 +106,23 @@ def peliculas(item):
patronBlock = r'<div\s+class="container-fluid greybg title-serie-lastep title-last-ep fixed-title-wrapper containerBottomBarTitle">'+end_block
patron = r'<a(?: rel="[^"]+")? href="(?P<url>[^"]+)"(?: class="[^"]+")?>[ ]<img class="[^"]+"[ ]title="[^"]+"[ ]alt="[^"]+"[ ](?:|meta-)?src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?:\d+.\d+)[ ]\((?P<lang>[a-zA-Z\-]+)[^<]+<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<'
elif item.args == 'nolost':
patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-danonperd">'+end_block
patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-danonperd">'+end_block
## pagination = 25
elif item.args == 'classic':
patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-classiche">'+end_block
## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<'
## pagination = 25
## elif item.args == 'anime':
##
##
else:
patronBlock = r'<div\s+class="container container-title-serie-new container-scheda" meta-slug="new">'+end_block
## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<'
## pagination = 25
#support.regexDbg(item, patron, headers)
#support.regexDbg(item, patronBlock, headers)
#debug = True
return locals()
@support.scrape
def episodios(item):
log()
@@ -132,7 +134,7 @@ def episodios(item):
def itemHook(item):
item.title = item.title.replace(item.fulltitle, '').replace('-','',1)
return item
#debug = True
return locals()
@@ -174,9 +176,6 @@ def newest(categoria):
item.action = "peliculas"
itemlist = peliculas(item)
## if itemlist[-1].action == "peliculas":
## itemlist.pop()
# Continua la ricerca in caso di errore
except:
import sys
+1 -10
View File
@@ -7,14 +7,5 @@
"thumbnail": "https://i.imgur.com/Nsa81r0.png",
"banner": "https://i.imgur.com/Nsa81r0.png",
"categories": ["movie", "tvshow", "anime", "vos"],
"settings": [
{
"id": "include_in_newest_anime",
"type": "bool",
"label": "Includi in Novità - Anime",
"default": false,
"enabled": false,
"visible": false
}
]
"settings": []
}
+124 -121
View File
@@ -6,9 +6,8 @@
"""
Problemi noti che non superano il test del canale:
NESSUNO (update 13-9-2019)
Alcuni video non si aprono sul sito...
Avvisi per il test:
i link per le categorie non sono TUTTI visibili nella pagina del sito:
vanno costruiti con i nomi dei generi che vedete nel CANALE.
@@ -22,17 +21,20 @@
genere-> televisione film
https://ilgeniodellostreaming.se/genere/televisione-film
Non va abilitato per:
Novità -> Anime
La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019)
Novità -> Serietv e Aggiornamenti nel canale:
- le pagine sono di 25 titoli
##### note per i dev #########
- La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019)
- in url: film o serietv
"""
import re
from platformcode import logger
from core import scrapertoolsV2, httptools, tmdb, support
from core.support import log, menu, aplay
from core import scrapertoolsV2, httptools, support
from core.support import log
from core.item import Item
from platformcode import config
@@ -49,136 +51,88 @@ def mainlist(item):
support.log(item)
film = ['/film/',
('Film Per Categoria',['', 'category', 'genres']),
('Film Per Anno',['', 'category', 'year']),
('Film Per Lettera',['/film-a-z/', 'category', 'letter']),
('Generi',['', 'genres', 'genres']),
('Per Lettera',['/film-a-z/', 'genres', 'letter']),
('Anni',['', 'genres', 'year']),
('Popolari',['/trending/?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/',
('Aggiornamenti', ['/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 = ''
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
def peliculas(item):
log(item)
## import web_pdb; web_pdb.set_trace()
log()
if item.args == 'search':
if item.action == 'search':
patronBlock = r'<div class="search-page">(?P<block>.*?)<footer class="main">'
patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\
'<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>[^>]+>(?P<type>[^<]+)'\
'<\/span>.*?<a href.*?>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\
'<\/a>[^>]+>(?:<span class="rating">IMDb\s*(?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']}
## elif item.args == 'newest':
## patronBlock = r'<div class="content"><header><h1>Aggiornamenti Serie</h1>'\
## '</header>(?P<block>.*?)</li></ul></div></div></div>'
## patron = r'src="(?P<thumb>[^"]+)".*?href="(?P<url>[^"]+)">[^>]+>(?P<episode>[^<]+)'\
## '<.*?"c">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<.+?<span class='\
## '"quality">(\5SUB-ITA|.+?)</span>'
## type_content_dict={'movie': ['film'], 'tvshow': ['tv']}
## type_action_dict={'findvideos': ['film'], 'episodios': ['tv']}
def itemHook(item):
if 'film' not in item.url:
item.contentType = 'tvshow'
item.action = 'episodios'
return item
else:
elif item.args == 'letter':
patron = r'<td class="mlnh-2"><a href="(?P<url>[^"]+)">(?P<title>.+?)'\
'[ ]?(?:\[(?P<lang>Sub-ITA)\])?<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})\s+<'
elif item.args == 'populared':
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})?<'
if item.contentType == 'movie':
endBlock = '</article></div>'
else:
endBlock = '<footer class="main">'
elif item.args == 'showtv':
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>.+?)<'
patronBlock = r'<header><h1>.+?</h1>(?P<block>.*?)'+endBlock
elif item.contentType == 'movie' and item.args != 'genres':
patronBlock = r'<header><h1>Film</h1>(?P<block>.*?)<div class="pagination">'
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'
if item.contentType == 'movie':
if item.args == 'letter':
patronBlock = r'<table class="table table-striped">(?P<block>.+?)</table>'
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+<'
elif item.args == 'populared':
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+)<'
else:
elif item.contentType == 'tvshow' or item.args == 'genres':
action = 'episodios'
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>[^<]+)'
## else:
## patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\
## '<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>'\
## '[^>]+>(?P<type>[^<]+)<\/span>.*?<a href.*?>(?P<title>[^<]+)'\
## '<\/a>(?P<lang>[^>])+>[^>]+>(?:<span class="rating">IMDb\s*'\
## '(?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']}
#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'
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'
else:
# TVSHOW
action = 'episodios'
if item.args == 'update':
action = 'findvideos'
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
def itemHook(item):
item.contentType = 'episode'
return item
else:
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>[^<]+))?'
patronNext = '<span class="current">[^<]+<[^>]+><a href="([^"]+)"'
## debug = True
return locals()
@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
#support.regexDbg(item, patron, headers)
#debug = True
return locals()
@@ -195,35 +149,62 @@ def episodios(item):
# debug = True
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):
log(categoria)
itemlist = []
item = Item()
action = peliculas
if categoria == 'peliculas':
item.contentType = 'movie'
item.url = host + '/film/'
elif categoria == 'series':
action = newep
#item.args = 'newest'
item.args = 'update'
item.contentType = 'tvshow'
item.url = host + '/aggiornamenti-serie/'
## elif categoria == 'anime':
## item.contentType = 'tvshow'
## item.url = host + '/anime/'
try:
item.action = action
itemlist = action(item)
item.action = 'peliculas'
itemlist = peliculas(item)
if itemlist[-1].action == action:
itemlist.pop()
except:
import sys
for line in sys.exc_info():
logger.error("{0}".format(line))
log("{0}".format(line))
return []
return itemlist
@@ -232,9 +213,31 @@ def newest(categoria):
def findvideos(item):
log()
itemlist =[]
matches, data = support.match(item, '<iframe class="metaframe rptss" src="([^"]+)"[^>]+>',headers=headers)
for url in matches:
html = httptools.downloadpage(url, headers=headers).data
data += str(scrapertoolsV2.find_multiple_matches(html, '<meta name="og:url" content="([^"]+)">'))
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')
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
+2 -1
View File
@@ -6,6 +6,7 @@
"language": ["ita","sub-ita"],
"thumbnail": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png",
"bannermenu": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png",
"categories": ["tvshow"],
"categories": ["tvshow", "vos"],
"not_active": ["include_in_newest_peliculas", "include_in_newest_anime"],
"settings": []
}
+63 -22
View File
@@ -4,15 +4,24 @@
# ------------------------------------------------------------
"""
"""
import re
Problemi noti che non superano il test del canale:
from core import httptools, scrapertools, support
Avvisi:
Ulteriori info:
"""
import re
from core import support, httptools, scrapertoolsV2
from core.item import Item
from platformcode import config
__channel__ = 'italiaserie'
host = config.get_channel_url(__channel__)
headers = [['Referer', host]]
list_servers = ['speedvideo']
list_quality = []
@@ -23,7 +32,7 @@ def mainlist(item):
support.log()
tvshow = ['/category/serie-tv/',
('Aggiornamenti', ['/ultimi-episodi/', 'peliculas', 'latest']),
('Aggiornamenti', ['/ultimi-episodi/', 'peliculas', 'update']),
('Generi', ['', 'category', 'Serie-Tv per Genere'])
]
@@ -38,14 +47,31 @@ def peliculas(item):
patron = r'<div class="post-thumb">\s*<a href="(?P<url>[^"]+)" '\
'title="(?P<title>[^"]+)">\s*<img src="(?P<thumb>[^"]+)"[^>]+>'
if item.args == "latest":
if item.args == 'update':
patron += r'.*?aj-eps">(?P<episode>.+?)[ ]?(?P<lang>Sub-Ita|Ita)</span>'
action = 'findvideos'
patronNext = r'<a class="next page-numbers" href="(.*?)">'
## debug = True
return locals()
@support.scrape
def episodios(item):
support.log()
patronBlock = r'</i> Stagione (?P<block>(?P<season>\d+)</div> '\
'<div class="su-spoiler-content".*?)<div class="clearfix">'
patron = r'(?:(?P<season>\d+)?</div> <div class="su-spoiler-content"(:?.+?)?> )?'\
'<div class="su-link-ep">\s+<a.*?href="(?P<url>[^"]+)".*?strong>[ ]'\
'(?P<title>.+?)[ ](?P<episode>\d+-\d+|\d+)[ ](?:-\s+(?P<title2>.+?))?'\
'[ ]?(?:(?P<lang>Sub-ITA))?[ ]?</strong>'
#debug = True
return locals()
@support.scrape
def category(item):
support.log()
@@ -56,24 +82,10 @@ def category(item):
return locals()
@support.scrape
def episodios(item):
support.log()
pagination = 24
patronBlock = r'</i> Stagione (?P<block>(?P<season>\d+)</div> '\
'<div class="su-spoiler-content".*?)<div class="clearfix">'
patron = r'(?:(?P<season>\d+)?</div> <div class="su-spoiler-content"(:?.+?)?> )?'\
'<div class="su-link-ep">\s+<a.*?href="(?P<url>[^"]+)".*?strong>[ ]'\
'(?P<title>.+?)[ ](?P<episode>\d+-\d+|\d+)[ ](?:-\s+(?P<title2>.+?))?'\
'[ ]?(?:(?P<lang>Sub-ITA))?[ ]?</strong>'
return locals()
def search(item, texto):
support.log("s=", texto)
item.url = host + "/?s=" + texto
item.contentType = 'tvshow'
try:
return peliculas(item)
# Continua la ricerca in caso di errore
@@ -92,7 +104,7 @@ def newest(categoria):
if categoria == "series":
item.url = host + "/ultimi-episodi/"
item.action = "peliculas"
item.args = "latest"
item.args = "update"
item.contentType = "episode"
itemlist = peliculas(item)
@@ -111,4 +123,33 @@ def newest(categoria):
def findvideos(item):
support.log()
return support.server(item, data=item.url)
if item.args == 'update':
itemlist = []
item.infoLabels['mediatype'] = 'episode'
data = httptools.downloadpage(item.url, headers=headers).data
data = re.sub('\n|\t', ' ', data)
data = re.sub(r'>\s+<', '> <', data)
url_video = scrapertoolsV2.find_single_match(data, r'<a rel="[^"]+" target="[^"]+" act="[^"]+"\s+href="([^"]+)" class="[^"]+-link".+?\d+.+?</strong> </a>', -1)
url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)" />')
goseries = support.typo("Vai alla Serie:", ' bold')
series = support.typo(item.contentSerieName, ' bold color kod')
itemlist = support.server(item, data=url_video)
itemlist.append(
Item(channel=item.channel,
title=goseries + series,
fulltitle=item.fulltitle,
show=item.show,
contentType='tvshow',
contentSerieName=item.contentSerieName,
url=url_serie,
action='episodios',
contentTitle=item.contentSerieName,
plot = goseries + series + "con tutte le puntate",
))
return itemlist
else:
return support.server(item, data=item.url)
+3 -27
View File
@@ -6,31 +6,7 @@
"language": ["ita"],
"thumbnail": "https:\/\/serietvonline.com\/wp-content\/uploads\/2016\/08\/logo2016-1.png",
"bannermenu": "https:\/\/serietvonline.com\/wp-content\/uploads\/2016\/08\/logo2016-1.png",
"categories": ["anime","tvshow","movie", "documentary"],
"settings": [
{
"id": "include_in_newest_series",
"type": "bool",
"label": "Includi in Novità - Serie TV",
"default": false,
"enabled": false,
"visible": false
},
{
"id": "include_in_newest_anime",
"type": "bool",
"label": "Includi in Novità - Anime",
"default": false,
"enabled": false,
"visible": false
},
{
"id": "include_in_newest_italiano",
"type": "bool",
"label": "Includi in Novità - Italiano",
"default": false,
"enabled": false,
"visible": false
}
]
"categories": ["anime","tvshow","movie","documentary"],
"not_active": ["include_in_newest_anime"],
"settings": []
}
+154 -99
View File
@@ -1,29 +1,34 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canale per serietvonline
# Canale per serietvonline.py
# ----------------------------------------------------------
"""
Problemi noti che non superano il test del canale:
- il solo film .45, nella lista titoli, ha come titolo nel canale '.'
- la ricerca dei titoli potrebbe non essere uguale ( da sistemare le regex )
indicate i titoli, con cui avete avuto problemi, e se sono film o serie.
Novità. Indicare in quale/i sezione/i è presente il canale:
- film, serie
Avvisi:
- Nelle pagine di liste avrete un elenco di 24 titoli per pagina,
invece della singola del sito
- Il Canale è incluso nella sola ricerca globale.
- Al massimo 25 titoli per le sezioni: Film
- Al massimo 35 titoli per le sezioni: Tutte le altre
Le pagine di liste sono lente a caricarsi in quanto scaricano anche le info...
"""
from core import support
from platformcode import logger, config
import re
from core import support, httptools, scrapertoolsV2
from platformcode import config
from core.item import Item
__channel__ = "serietvonline"
host = config.get_channel_url(__channel__)
headers = [['Referer', host]]
host = ""
headers = ""
def findhost():
global host, headers
data = httptools.downloadpage('https://serietvonline.me/').data
host = scrapertoolsV2.find_single_match(data, r'<a class="pure-button pure-button-primary" title=\'serie tv online\' href="([^"]+)">')
headers = [['Referer', host]]
findhost()
list_servers = ['akvideo', 'wstream', 'backin', 'vidtome', 'nowvideo']
list_quality = ['default']
@@ -33,12 +38,16 @@ list_quality = ['default']
def mainlist(item):
support.log()
film = ['/lista-film/',
('Ultimi Aggiunti', ['/ultimi-film-aggiunti/', 'peliculas', 'latest'])
film = ['/ultimi-film-aggiunti/',
('Lista', ['/lista-film/', 'peliculas', 'lista'])
]
tvshow = ['',
('HD', ['/lista-serie-tv-in-altadefinizione/', 'peliculas', 'hd'])
('Aggiornamenti', ['/ultimi-episodi-aggiunti/', 'peliculas', 'update']),
('Tutte', ['/lista-serie-tv/', 'peliculas', 'qualcosa']),
('Italiane', ['/lista-serie-tv-italiane/', 'peliculas', 'qualcosa']),
('Anni 50-60-70-80-90', ['/lista-serie-tv-anni-60-70-80/', 'peliculas', 'qualcosa']),
('HD', ['/lista-serie-tv-in-altadefinizione/', 'peliculas', 'qualcosa'])
]
anime = ['/lista-cartoni-animati-e-anime/']
@@ -54,106 +63,152 @@ def peliculas(item):
support.log()
blacklist = ['DMCA', 'Contatti', 'Attenzione NON FARTI OSCURARE', 'Lista Ccartoni Animati e Anime']
if item.action == 'search':
patronBlock = r'>Lista Serie Tv</a></li></ul></div><div id="box_movies">'\
'(?P<block>.*?)<div id="paginador">'
patron = r'<div class="movie"><div class="imagen"> <img src="(?P<thumb>[^"]+)" '\
'alt="(?:(?P<title>.+?)[ ]?(?:\d+)?)?" /> <a href="(?P<url>[^"]+)">'\
'.+?<h2>(?:.+?(?P<year>\d+)?)</h2>(?: <span class="year">'\
'(\d+)(?:|–|-\d+)?</span>)?</div>'
def itemHook(item):
support.log("ITEMHOOK PRIMA: ", item)
if 'film' in item.url:
item.action = 'findvideos'
item.contentType = 'movie'
item.infoLabels['mediatype'] = 'movie'
else:
item.action = 'episodios'
item.contentType = 'tvshow'
item.infoLabels['mediatype'] = 'tvshow'
support.log("ITEMHOOK DOPO: ", item)
return item
elif item.extra == 'tvshow' or item.contentType == 'tvshow':
# SEZIONE Serie TV- Anime!
action = 'episodios'
if 'anime' in item.url:
patronBlock = r'<h1>Lista Cartoni Animati e Anime</h1>(?P<block>.*?)<div class="footer_c">'
patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>'
else:
if item.args == 'hd':
patronBlock = r'<h1>Lista Serie Tv in AltaDefinizione</h1>(?P<block>.*?)'\
'<div class="footer_c">'
patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>'
elif item.args == 'doc':
patronBlock = r'<h1>Lista Documentari</h1>(?P<block>.*?)<div class="footer_c">'
patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>'
else:
patronBlock = r'<div id="box_movies">(?P<block>.*?)<div id="paginador">'
patron = r'<div class="movie">[^>]+>.+?src="(?P<thumb>[^"]+)" alt="[^"]+"'\
'.+?href="(?P<url>[^"]+)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[ ]'\
'(?P<rating>\d+.\d+|\d+)<[^>]+>[^>]+><h2>(?P<title>[^"]+)</h2>[ ]?'\
'(?:<span class="year">(?P<year>\d+|\-\d+))?<'
else:
# SEZIONE FILM
action = 'findvideos'
pagination = 24
if not item.args:
patron = r'href="(?P<url>[^"]+)"[^>]+>(?P<title>.*?)[ ]?(?P<year>\d+)?'\
'(?: Streaming | MD iSTANCE )?<'
patronBlock = r'Lista dei film disponibili in streaming e anche in download\.'\
'</p>(?P<block>.*?)<div class="footer_c">'
elif item.args == 'latest':
patronBlock = r'<h1>Ultimi film aggiunti</h1>(?P<block>.*?)<div class="footer_c">'
patron = r'<tr><td><a href="(?P<url>[^"]+)"(?:|.+?)?>(?:&nbsp;&nbsp;)?[ ]?'\
'(?P<title>.*?)[ ]?(?:HD)?[ ]?(?P<year>\d+)?'\
'(?: | HD | Streaming | MD(?: iSTANCE)? )?</a>'
patronBlock = r'<h1>.+?</h1>(?P<block>.*?)<div class="footer_c">'
patronNext = r'<div class="siguiente"><a href="([^"]+)" >'
## debug = True
## if 'film' in item.url:
## contentType = 'movie'
## action = 'findvideos'
## else:
## contentType = 'tvshow'
## action = 'episodios'
if item.args == 'search':
patronBlock = r'>Lista Serie Tv</a></li></ul></div><div id="box_movies">(?P<block>.*?)<div id="paginador">'
patron = r'<div class="movie">[^>]+[^>]+>\s?<img src="(?P<thumb>[^"]+)" alt="(?P<title>.+?)\s?(?P<year>[\d\-]+)?"[^>]+>\s?<a href="(?P<url>[^"]+)">'
## def itemHook(item):
## if 'film' in item.url:
## item.action = 'findvideos'
## item.contentType = 'movie'
## else:
## item.contentType = 'tvshow'
## item.action = 'episodios'
## return item
elif item.contentType == 'tvshow':
# SEZIONE Serie TV- Anime - Documentari
pagination = 35
if not item.args and 'anime' not in item.url:
patron = r'<div class="movie">[^>]+>.+?src="(?P<thumb>[^"]+)" alt="[^"]+".+?href="(?P<url>[^"]+)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[ ](?P<rating>\d+.\d+|\d+)<[^>]+>[^>]+><h2>(?P<title>[^"]+)</h2>[ ]?(?:<span class="year">(?P<year>\d+|\-\d+))?<'
else:
patron = r'(?:<td>)?<a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<'
if item.args == 'update':
action = 'findvideos'
patron = r'<td><a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<'
else:
# SEZIONE FILM
pagination = 25
if item.args == 'lista':
patron = r'href="(?P<url>[^"]+)"[^>]+>(?P<title>.*?)[ ]?(?P<year>\d+)?(?: Streaming | MD iSTANCE )?<'
patronBlock = r'Lista dei film disponibili in streaming e anche in download\.</p>(?P<block>.*?)<div class="footer_c">'
else:
#patronBlock = r'<h1>Ultimi film aggiunti</h1>(?P<block>.*?)<div class="footer_c">'
patron = r'<tr><td><a href="(?P<url>[^"]+)"(?:|.+?)?>(?:&nbsp;&nbsp;)?[ ]?(?P<title>.*?)[ ]?(?:HD)?[ ]?(?P<year>\d+)?(?: | HD | Streaming | MD(?: iSTANCE)? )?</a>'
def itemHook(item):
if 'film' in item.url:
item.action = 'findvideos'
item.contentType = 'movie'
elif item.args == 'update':
pass
else:
item.contentType = 'tvshow'
item.action = 'episodios'
return item
#support.regexDbg(item, patronBlock, headers)
#debug = True
return locals()
@support.scrape
def episodios(item):
support.log()
action = 'findvideos'
patronBlock = r'<table>(?P<block>.*?)<\/table>'
patron = r'<tr><td>(?:[^<]+)[ ](?:Parte)?(?P<episode>\d+x\d+)(?:|[ ]?(?P<title2>.+?)?(?:avi)?)<(?P<url>.*?)</td><tr>'
patron = r'<tr><td>(?:[^<]+)[ ](?:Parte)?(?P<episode>\d+x\d+|\d+)(?:|[ ]?'\
'(?P<title2>.+?)?)<(?P<url>.*?)</td><tr>'
## debug = True
#debug = True
return locals()
def search(item, text):
support.log("CERCA :" ,text, item)
item.url = "%s/?s=%s" % (host, text)
try:
item.args = 'search'
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(categoria)
itemlist = []
item = Item()
if categoria == 'peliculas':
item.contentType = 'movie'
item.url = host + '/ultimi-film-aggiunti/'
elif categoria == 'series':
item.args = 'update'
item.contentType = 'tvshow'
item.url = host +'/ultimi-episodi-aggiunti/'
try:
item.action = 'peliculas'
itemlist = peliculas(item)
except:
import sys
for line in sys.exc_info():
support.log("{0}".format(line))
return []
return itemlist
def findvideos(item):
support.log()
if item.contentType == 'movie':
return support.server(item, headers=headers)
else:
return support.server(item, item.url)
if item.args != 'update':
return support.server(item, item.url)
else:
itemlist = []
item.infoLabels['mediatype'] = 'episode'
def search(item, texto):
support.log("CERCA :" ,texto, item)
item.url = "%s/?s=%s" % (host, texto)
data = httptools.downloadpage(item.url, headers=headers).data
data = re.sub('\n|\t', ' ', data)
data = re.sub(r'>\s+<', '> <', data)
#support.log("DATA - HTML:\n", data)
url_video = scrapertoolsV2.find_single_match(data, r'<tr><td>(.+?)</td><tr>', -1)
url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>')
goseries = support.typo("Vai alla Serie:", ' bold')
series = support.typo(item.contentSerieName, ' bold color kod')
itemlist = support.server(item, data=url_video)
try:
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
itemlist.append(
Item(channel=item.channel,
title=goseries + series,
fulltitle=item.fulltitle,
show=item.show,
contentType='tvshow',
contentSerieName=item.contentSerieName,
url=url_serie,
action='episodios',
contentTitle=item.contentSerieName,
plot = goseries + series + "con tutte le puntate",
))
return itemlist
+4 -62
View File
@@ -3,68 +3,10 @@
"name": "SerieTVU",
"active": true,
"adult": false,
"language": ["ita"],
"language": ["ita", "sub-ita"],
"thumbnail": "serietvu.png",
"banner": "serietvu.png",
"categories": ["tvshow"],
"settings": [
{
"id": "channel_host",
"type": "text",
"label": "Host del canale",
"default": "https://www.serietvu.club",
"enabled": true,
"visible": true
},
{
"id": "include_in_global_search",
"type": "bool",
"label": "Includi ricerca globale",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "include_in_newest_series",
"type": "bool",
"label": "Includi in Novità - Serie TV",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "include_in_newest_italiano",
"type": "bool",
"label": "Includi in Novità - Italiano",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "checklinks",
"type": "bool",
"label": "Verifica se i link esistono",
"default": false,
"enabled": true,
"visible": true
},
{
"id": "checklinks_number",
"type": "list",
"label": "Numero de link da verificare",
"default": 1,
"enabled": true,
"visible": "eq(-1,true)",
"lvalues": [ "1", "3", "5", "10" ]
},
{
"id": "filter_languages",
"type": "list",
"label": "Mostra link in lingua...",
"default": 0,
"enabled": true,
"visible": true,
"lvalues": ["Non filtrare","IT"]
}
]
"categories": ["tvshow", "vos"],
"not_active": ["include_in_newest_peliculas", "include_in_newest_anime"],
"settings": []
}
+85 -251
View File
@@ -1,28 +1,22 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canale per SerieTVU
# Thanks to Icarus crew & Alfa addon & 4l3x87
# Canale per serietvu.py
# ----------------------------------------------------------
"""
Trasformate le sole def per support.menu e support.scrape
da non inviare nel test.
Test solo a trasformazione completa
La pagina novità contiene al max 25 titoli
"""
import re
from core import tmdb, scrapertools, support
from core import support, httptools, scrapertoolsV2
from core.item import Item
from core.support import log
from platformcode import config, logger
from platformcode import config
__channel__ = 'serietvu'
host = config.get_channel_url(__channel__)
headers = [['Referer', host]]
IDIOMAS = {'Italiano': 'IT'}
list_language = IDIOMAS.values()
list_servers = ['speedvideo']
list_quality = ['default']
@@ -30,235 +24,74 @@ list_quality = ['default']
@support.menu
def mainlist(item):
log()
tvshow = ['/category/serie-tv',
('Novità', ['/ultimi-episodi', 'latestep']),
('Categorie', ['', 'categorie'])
('Novità', ['/ultimi-episodi/', 'peliculas', 'update']),
('Generi', ['', 'genres', 'genres'])
]
return locals()
# ----------------------------------------------------------------------------------------------------------------
def cleantitle(scrapedtitle):
log()
scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle.strip())
scrapedtitle = scrapedtitle.replace('[HD]', '').replace('', '\'').replace(' Il Trono di Spade', '').replace(
'Flash 2014', 'Flash').replace('"', "'")
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
if year:
scrapedtitle = scrapedtitle.replace('(' + year + ')', '')
return scrapedtitle.strip()
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
@support.scrape
def peliculas(item):
log()
itemlist = []
patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">'
patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<'
matches, data = support.match(item, patron, headers=headers)
patronBlock = r'<div class="wrap">\s+<h.>.*?</h.>(?P<block>.*?)<footer>'
for scrapedurl, scrapedimg, scrapedtitle in matches:
infoLabels = {}
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
if year:
infoLabels['year'] = year
scrapedtitle = cleantitle(scrapedtitle)
if item.args != 'update':
action = 'episodios'
patron = r'<div class="item">\s*<a href="(?P<url>[^"]+)" data-original="(?P<thumb>[^"]+)" class="lazy inner">[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<'
else:
action = 'findvideos'
patron = r'<div class="item">\s+?<a href="(?P<url>[^"]+)"\s+?data-original="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)<[^>]+>\((?P<episode>[\dx\-]+)\s+?(?P<lang>Sub-Ita|[iITtAa]+)\)<'
pagination = 25
itemlist.append(
Item(channel=item.channel,
action="episodios",
title=scrapedtitle,
fulltitle=scrapedtitle,
url=scrapedurl,
thumbnail=scrapedimg,
show=scrapedtitle,
infoLabels=infoLabels,
contentType='episode',
folder=True))
patronNext = r'<li><a href="([^"]+)"\s+?>Pagina successiva'
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
#support.regexDbg(item, patron, headers)
#debug = True
return locals()
# Pagine
support.nextPage(itemlist, item, data, '<li><a href="([^"]+)">Pagina successiva')
return itemlist
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
@support.scrape
def episodios(item):
log()
itemlist = []
patron = r'<option value="(\d+)"[\sselected]*>.*?</option>'
matches, data = support.match(item, patron, headers=headers)
for value in matches:
patron = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % value
blocco = scrapertools.find_single_match(data, patron)
log(blocco)
patron = r'(<a data-id="\d+[^"]*" data-href="([^"]+)"(?:\sdata-original="([^"]+)")?\sclass="[^"]+">)[^>]+>[^>]+>([^<]+)<'
matches = scrapertools.find_multiple_matches(blocco, patron)
for scrapedextra, scrapedurl, scrapedimg, scrapedtitle in matches:
contentlanguage = ''
if 'sub-ita' in scrapedtitle.lower():
contentlanguage = 'Sub-ITA'
scrapedtitle = scrapedtitle.replace(contentlanguage, '')
number = cleantitle(scrapedtitle.replace("Episodio", "")).strip()
title = value + "x" + number.zfill(2)
title += " "+support.typo(contentlanguage, '_ [] color kod') if contentlanguage else ''
infoLabels = {}
infoLabels['episode'] = number.zfill(2)
infoLabels['season'] = value
itemlist.append(
Item(channel=item.channel,
action="findvideos",
title=title,
fulltitle=scrapedtitle,
contentType="episode",
url=scrapedurl,
thumbnail=scrapedimg,
extra=scrapedextra,
infoLabels=infoLabels,
folder=True))
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
support.videolibrary(itemlist, item, 'bold color kod')
return itemlist
patronBlock = r'</select><div style="clear:both"></div></h2>(?P<block>.*?)<div id="trailer" class="tab">'
patron = r'(?:<div class="list (?:active)?" data-id="(?P<season>\d+)">[^>]+>)?\s+<a data-id="(?P<episode>\d+)(?:[ ](?P<lang>[SuUbBiItTaA\-]+))?"(?P<url>[^>]+)>[^>]+>[^>]+>(?P<title>.+?)(?:\sSub-ITA)?<'
#support.regexDbg(item, patronBlock, headers)
#debug = True
return locals()
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
def findvideos(item):
log()
return support.server(item, data=item.url)
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
def findepisodevideo(item):
@support.scrape
def genres(item):
log()
patron_block = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % item.extra[0][0]
patron = r'<a data-id="%s[^"]*" data-href="([^"]+)"(?:\sdata-original="[^"]+")?\sclass="[^"]+">' % item.extra[0][1].lstrip("0")
matches = support.match(item, patron, patron_block, headers)[0]
data = ''
if len(matches) > 0:
data = matches[0]
item.contentType = 'movie'
return support.server(item, data=data)
blacklist = ["Home Page", "Calendario Aggiornamenti"]
action = 'peliculas'
patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>'
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>'
#debug = True
return locals()
# ================================================================================================================
def search(item, text):
log(text)
item.url = host + "/?s=" + text
try:
item.contentType = 'tvshow'
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
log("%s" % line)
return []
# ----------------------------------------------------------------------------------------------------------------
def latestep(item):
log()
itemlist = []
titles = []
patron_block = r"Ultimi episodi aggiunti.*?<h2>"
patron = r'<a href="([^"]*)"\sdata-src="([^"]*)"\sclass="owl-lazy.*?".*?class="title">(.*?)<small>\((\d*?)x(\d*?)\s(Sub-Ita|Ita)'
matches = support.match(item, patron, patron_block, headers, host)[0]
for scrapedurl, scrapedimg, scrapedtitle, scrapedseason, scrapedepisode, scrapedlanguage in matches:
infoLabels = {}
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
if year:
infoLabels['year'] = year
infoLabels['episode'] = scrapedepisode
infoLabels['season'] = scrapedseason
episode = scrapedseason + "x" + scrapedepisode
scrapedtitle = cleantitle(scrapedtitle)
title = scrapedtitle + " - " + episode
contentlanguage = ""
if scrapedlanguage.strip().lower() != 'ita':
title += " "+support.typo("Sub-ITA", '_ [] color kod')
contentlanguage = 'Sub-ITA'
titles.append(title)
itemlist.append(
Item(channel=item.channel,
action="findepisodevideo",
title=title,
fulltitle=title,
url=scrapedurl,
extra=[[scrapedseason, scrapedepisode]],
thumbnail=scrapedimg,
contentSerieName=scrapedtitle,
contentLanguage=contentlanguage,
contentType='episode',
infoLabels=infoLabels,
folder=True))
patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">'
patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<small>([^<]+)<'
matches = support.match(item, patron, headers=headers)[0]
for scrapedurl, scrapedimg, scrapedtitle, scrapedinfo in matches:
infoLabels = {}
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
if year:
infoLabels['year'] = year
scrapedtitle = cleantitle(scrapedtitle)
infoLabels['tvshowtitle'] = scrapedtitle
episodio = re.compile(r'(\d+)x(\d+)', re.DOTALL).findall(scrapedinfo)
infoLabels['episode'] = episodio[0][1]
infoLabels['season'] = episodio[0][0]
episode = infoLabels['season'] + "x" + infoLabels['episode']
title = "%s - %s" % (scrapedtitle, episode)
title = title.strip()
contentlanguage = ""
if 'sub-ita' in scrapedinfo.lower():
title += " "+support.typo("Sub-ITA", '_ [] color kod')
contentlanguage = 'Sub-ITA'
if title in titles: continue
itemlist.append(
Item(channel=item.channel,
action="findepisodevideo",
title=title,
fulltitle=title,
url=scrapedurl,
extra=episodio,
thumbnail=scrapedimg,
contentSerieName=scrapedtitle,
contentLanguage=contentlanguage,
infoLabels=infoLabels,
contentType='episode',
folder=True))
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
return itemlist
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
def newest(categoria):
log(categoria)
itemlist = []
@@ -266,51 +99,52 @@ def newest(categoria):
try:
if categoria == "series":
item.url = host + "/ultimi-episodi"
item.action = "latestep"
itemlist = latestep(item)
if itemlist[-1].action == "latestep":
itemlist.pop()
item.action = "peliculas"
item.contentType = 'tvshow'
item.args = 'update'
itemlist = peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("{0}".format(line))
log("{0}".format(line))
return []
return itemlist
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
def search(item, texto):
log(texto)
item.url = host + "/?s=" + texto
try:
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
# ================================================================================================================
# ----------------------------------------------------------------------------------------------------------------
@support.scrape
def categorie(item):
def findvideos(item):
log()
if item.args != 'update':
return support.server(item, data=item.url)
else:
itemlist = []
item.infoLabels['mediatype'] = 'episode'
blacklist = ["Home Page", "Calendario Aggiornamenti"]
action = 'peliculas'
patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>'
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>'
debug = True
data = httptools.downloadpage(item.url, headers=headers).data
data = re.sub('\n|\t', ' ', data)
data = re.sub(r'>\s+<', '> <', data)
## support.log("DATA - HTML:\n", data)
url_video = scrapertoolsV2.find_single_match(data, r'<div class="item"> <a data-id="[^"]+" data-href="([^"]+)" data-original="[^"]+"[^>]+> <div> <div class="title">Episodio \d+', -1)
url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>')
goseries = support.typo("Vai alla Serie:", ' bold')
series = support.typo(item.contentSerieName, ' bold color kod')
return locals()
# ================================================================================================================
itemlist = support.server(item, data=url_video)
itemlist.append(
Item(channel=item.channel,
title=goseries + series,
fulltitle=item.fulltitle,
show=item.show,
contentType='tvshow',
contentSerieName=item.contentSerieName,
url=url_serie,
action='episodios',
contentTitle=item.contentSerieName,
plot = goseries + series + "con tutte le puntate",
))
#support.regexDbg(item, patronBlock, headers)
return itemlist
+3 -3
View File
@@ -7,7 +7,7 @@
"thumbnail": "toonitalia.png",
"banner": "toonitalia.png",
"categories": ["tvshow", "movie", "vos", "anime"],
"not_active":["include_in_newest_peliculas"],
"default_off":["include_in_newest"],
"not_active":["include_in_newest_peliculas", "include_in_newest_series"],
"default_off":["include_in_newest"],
"settings": []
}
}
+3 -2
View File
@@ -218,6 +218,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
scraped[kk] = val
if scraped['season']:
stagione = scraped['season']
episode = scraped['season'] +'x'+ scraped['episode']
elif stagione:
episode = stagione +'x'+ scraped['episode']
@@ -236,7 +237,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
# make formatted Title [longtitle]
s = ' - '
title = episode + (s if episode and title else '') + title
title = episode + (s if episode and title else '') + title
longtitle = title + (s if title and title2 else '') + title2
longtitle = typo(longtitle, 'bold')
longtitle += typo(quality, '_ [] color kod') if quality else ''
@@ -400,7 +401,7 @@ def scrape(func):
if 'itemlistHook' in args:
itemlist = args['itemlistHook'](itemlist)
if (pagination and len(matches) <= pag * pagination) or not pagination: # next page with pagination
if patronNext and inspect.stack()[1][3] != 'newest':
nextPage(itemlist, item, data, patronNext, function)
+3 -3
View File
@@ -392,7 +392,7 @@ def get_newest(channel_id, categoria):
def get_title(item):
support.log("ITEM NEWEST ->", item)
#support.log("ITEM NEWEST ->", item)
# item.contentSerieName c'è anche se è un film
if item.contentSerieName and item.contentType != 'movie': # Si es una serie
title = item.contentSerieName
@@ -671,7 +671,7 @@ def cb_custom_button(item, dict_values):
dict_values[v] = not value
if config.set_setting("custom_button_value_news", not value, item.channel) == True:
return {"label": "Ninguno"}
return {"label": config.get_localized_string(59992)}
else:
return {"label": "Todos"}
return {"label": config.get_localized_string(59991)}