fix: riscritto per i decoratori
This commit is contained in:
@@ -1,52 +1,11 @@
|
||||
{
|
||||
"id": "dreamsub",
|
||||
"name": "DreamSub",
|
||||
"language": ["ita"],
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"thumbnail": "dreamsub.png",
|
||||
"banner": "dreamsub.png",
|
||||
"categories": ["anime","vosi","vos"],
|
||||
"settings": [
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Includi ricerca globale",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_anime",
|
||||
"type": "bool",
|
||||
"label": "Includi in Novità - Anime",
|
||||
"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": "autorenumber",
|
||||
"type": "bool",
|
||||
"label": "@70712",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "autorenumber_mode",
|
||||
"type": "bool",
|
||||
"label": "@70688",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": "eq(-1,true)"
|
||||
}
|
||||
]
|
||||
"id": "dreamsub",
|
||||
"name": "DreamSub",
|
||||
"language": ["ita", "vosi"],
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"thumbnail": "dreamsub.png",
|
||||
"banner": "dreamsub.png",
|
||||
"categories": ["anime", "vos"],
|
||||
"settings": []
|
||||
}
|
||||
|
||||
@@ -1,112 +1,293 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per dreamsub
|
||||
# Canale per 'dreamsub'
|
||||
# ------------------------------------------------------------
|
||||
# ------------------------------------------------------------
|
||||
"""
|
||||
|
||||
Problemi noti che non superano il test del canale:
|
||||
- indicare i problemi
|
||||
|
||||
Avvisi:
|
||||
- Gli episodi sono divisi per pagine di 20
|
||||
- In Novità->Anime, cliccare sulla home il bottone "Ultime inserite"
|
||||
Se avete più titoli in KOD, ridimensiona il browser in modo che si vedano i titoli
|
||||
a gruppi di 3 e ricontrollare, è un problema del sito.
|
||||
|
||||
|
||||
Ulteriori info:
|
||||
-
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
NOTA per i DEV:
|
||||
- Dai risultati dei Menu vengono tolti quei titoli
|
||||
che non hanno la corrispettiva parola nel link, secondo lo schema seguente:
|
||||
Menu Parole nel link
|
||||
---------------------------
|
||||
OAV oav
|
||||
OVA ova
|
||||
Speciali movie
|
||||
Movie movie
|
||||
Serie Tutti gli altri casi
|
||||
Es:
|
||||
https://www.dreamsub.stream/oav/another-the-other - è un OAV
|
||||
"""
|
||||
# Qui gli import
|
||||
import re
|
||||
import urlparse
|
||||
import copy
|
||||
|
||||
from core import scrapertoolsV2, httptools, servertools, tmdb, support
|
||||
from specials.autorenumber import renumber
|
||||
from core.support import menu, log, scrape
|
||||
from core import support
|
||||
from platformcode import config
|
||||
##from specials.autorenumber import renumber
|
||||
from specials import autorenumber
|
||||
# in caso di necessità
|
||||
|
||||
from core import scrapertoolsV2, httptools, servertools, tmdb
|
||||
from core.item import Item
|
||||
from platformcode import logger, config
|
||||
#from lib import unshortenit
|
||||
|
||||
##### fine import
|
||||
__channel__ = "dreamsub"
|
||||
host = config.get_channel_url(__channel__)
|
||||
headers = [['Referer', host]]
|
||||
|
||||
list_servers = ['verystream', 'streamango', 'openload']
|
||||
# server di esempio...
|
||||
list_servers = ['verystream', 'streamango', 'openload', 'directo']
|
||||
# quality di esempio
|
||||
list_quality = ['default']
|
||||
|
||||
#### Inizio delle def principali ###
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
log()
|
||||
support.log(item)
|
||||
|
||||
|
||||
anime = ['/anime',
|
||||
## ('Novità', ['']),
|
||||
## ('OAV', ['/search/oav', 'peliculas', 'oav']),
|
||||
## ('OVA', ['/search/ova', 'peliculas', 'ova']),
|
||||
('Movie', ['/search/movie', 'peliculas', 'special']),
|
||||
('Film', ['/search/film', 'peliculas', 'special']),
|
||||
('Categorie', ['/filter?genere=','genres']),
|
||||
## ('Ultimi Episodi', ['', 'last'])
|
||||
]
|
||||
"""
|
||||
Eventuali Menu per voci non contemplate!
|
||||
"""
|
||||
|
||||
return locals()
|
||||
|
||||
@support.scrape
|
||||
def peliculas(item):
|
||||
support.log(item)
|
||||
#dbg # decommentare per attivare web_pdb
|
||||
|
||||
anime = True
|
||||
action = 'episodios'
|
||||
item.contentType = 'tvshow'
|
||||
if item.args == 'newest':
|
||||
patronBlock = r'<div class="showRoomGoLeft" sr="ultime"></div>(?P<block>.*?)<div class="showRoomGoRight" sr="ultime">'
|
||||
else:
|
||||
patronBlock = r'<input type="submit" value="Vai!" class="blueButton">(?P<block>.*?)<div class="footer">'
|
||||
|
||||
patron = r'<div class="showStreaming"> <b>(?P<title>[^<]+).+?Stato streaming: '\
|
||||
'(?:[^<]+)<.*?Lingua:[ ](?P<lang1>ITA\/JAP|ITA|JAP)?(?:[ ])?'\
|
||||
'(?P<lang2>SUB ITA)?<br>.+?href="(?P<url>[^"]+)".+?'\
|
||||
'background: url\((?P<thumb>[^"]+)\).+?<div class="tvTitle">.+?'\
|
||||
'<strong>Anno di inizio</strong>: (?P<year>\d+)<br>'
|
||||
|
||||
patronNext = '<li class="currentPage">[^>]+><li[^<]+<a href="([^"]+)">'
|
||||
|
||||
def itemHook(item):
|
||||
support.log("ITEMHOOK -> ", item)
|
||||
lang = []
|
||||
if item.lang1 == 'ITA/JAP' or item.lang1 == 'ITA':
|
||||
lang.append('ITA')
|
||||
|
||||
if item.lang1 == 'JAP' and item.lang2 == 'SUB ITA' or item.lang2 == 'SUB ITA':
|
||||
lang.append('Sub-ITA')
|
||||
support.log("ITEMHOOK LANG-> ", lang)
|
||||
item.contentLanguage = lang
|
||||
|
||||
if len(lang) == 2:
|
||||
item.title += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'+' [COLOR 0xFF65B3DA][' + lang[1] + '][/COLOR]'
|
||||
elif len(lang) == 1 and lang[0] != 'ITA':
|
||||
item.title += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'
|
||||
|
||||
# se si riesce a differenziare in qualche modo tramite il link
|
||||
## if item.args == 'oav':
|
||||
## if not '/oav/' in url:
|
||||
## continue
|
||||
## elif item.args == 'ova':
|
||||
## if not '/ova/' in url:
|
||||
## continue
|
||||
## elif item.args == 'special':
|
||||
if item.args == 'search' or item.args == 'special':
|
||||
## if '/movie/' in item.url:
|
||||
## item.args = 'special'
|
||||
## if item.args == 'special':
|
||||
item.action = 'findvideos'
|
||||
item.contentType = 'movie'
|
||||
if not '/movie/' in item.url:
|
||||
pass
|
||||
return item
|
||||
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
@support.scrape
|
||||
def episodios(item):
|
||||
support.log(item)
|
||||
#dbg
|
||||
anime = True
|
||||
## item.contentType = 'episode'
|
||||
action = 'findvideos'
|
||||
blacklist = ['']
|
||||
|
||||
patronBlock = r'<div class="seasonEp">(?P<block>.*?)<div class="footer">'
|
||||
patron = r'<li><a href="(?P<url>[^"]+)"[^<]+<b>(?:.+?)[ ](?P<episode>\d+)<\/b>[^>]+>(?P<title>[^<]+)<\/i>[ ]\((?P<lang1>ITA)?\s?.+?\s?(?P<lang2>Sub ITA)?.+?\)<\/a>'
|
||||
pagination = ''
|
||||
|
||||
#UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18: ordinal not in range(128)
|
||||
def itemHook(item):
|
||||
support.log("ITEMHOOK EPISODE LANG1 -> ", item)
|
||||
lang = []
|
||||
if item.lang1 == 'ITA':
|
||||
lang.append('ITA')
|
||||
|
||||
if item.lang2 == 'Sub ITA':
|
||||
lang.append('Sub-ITA')
|
||||
support.log("ITEMHOOK EPISODE LANG2-> ", lang)
|
||||
item.contentLanguage = lang
|
||||
support.log("ITEMHOOK EPISODE LANG3 -> ", item, lang)
|
||||
if len(lang) ==2:
|
||||
item.title += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'+' [COLOR 0xFF65B3DA][' + lang[1] + '][/COLOR]'
|
||||
item.show += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'+' [COLOR 0xFF65B3DA][' + lang[1] + '][/COLOR]'
|
||||
elif len(lang) == 1 and lang[0] != 'ITA':
|
||||
item.title += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'
|
||||
item.show += ' [COLOR 0xFF65B3DA][' + lang[0] + '][/COLOR]'
|
||||
return item
|
||||
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
@support.scrape
|
||||
def genres(item):
|
||||
support.log(item)
|
||||
#dbg
|
||||
item.contentType = ''
|
||||
action = 'peliculas'
|
||||
blacklist = ['tutti']
|
||||
patron = r'<option value="(?P<title>[^"]+)">'
|
||||
patronBlock = r'<select name="genere" id="genere" class="selectInput">(?P<block>.*?)</select>'
|
||||
|
||||
def itemHook(item):
|
||||
item.contentTitle = item.contentTitle.replace(' ', '+')
|
||||
item.url = host+'/filter?genere='+item.contentTitle
|
||||
return item
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
def search(item, text):
|
||||
support.log('search', item)
|
||||
itemlist = []
|
||||
|
||||
menu(itemlist, 'Anime / Cartoni', 'peliculas', host + '/anime', 'tvshow')
|
||||
menu(itemlist, 'Categorie', 'categorie', host + '/filter?genere=', 'tvshow')
|
||||
menu(itemlist, 'Ultimi Episodi', 'last', host, 'episode')
|
||||
menu(itemlist, 'Cerca...', 'search')
|
||||
support.aplay(item, itemlist, list_servers, list_quality)
|
||||
support.channel_config(item, itemlist)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
log(texto)
|
||||
item.url = host + '/search/' + texto
|
||||
text = text.replace(' ', '+')
|
||||
item.url = host + '/search/' + text
|
||||
item.contentType = item.contentType
|
||||
item.args = 'search'
|
||||
try:
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
# Se captura la excepcion, para no interrumpir al buscador global si un canal falla
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
support.log('search log:', line)
|
||||
return []
|
||||
|
||||
|
||||
def newest(categoria):
|
||||
log(categoria)
|
||||
support.log('newest ->', categoria)
|
||||
itemlist = []
|
||||
item = Item()
|
||||
item.contentType = 'tvshow'
|
||||
item.args = 'newest'
|
||||
try:
|
||||
if categoria == "anime":
|
||||
item.url = host
|
||||
item.action = "ultimiep"
|
||||
itemlist = ultimiep(item)
|
||||
item.url = host
|
||||
item.action = 'peliculas'
|
||||
itemlist = peliculas(item)
|
||||
|
||||
if itemlist[-1].action == "ultimiep":
|
||||
itemlist.pop()
|
||||
# Continua la ricerca in caso di errore
|
||||
if itemlist[-1].action == 'peliculas':
|
||||
itemlist.pop()
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("{0}".format(line))
|
||||
log('newest log: ', {0}.format(line))
|
||||
return []
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
itemlist = scrape(item, r'Lingua[^<]+<br>\s*<a href="(?:Lista episodi )?([^"]+)" title="(?:Lista episodi )?(.*?)(?: \(([0-9]+)\))?(?: Streaming)?">', ['url', 'title', 'year'], action='episodios', patron_block='<input type="submit" value="Vai!" class="blueButton">(.*?)<div class="footer">', patronNext='<li class="currentPage">[^>]+><li[^<]+<a href="([^"]+)">')
|
||||
renumber(itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def last(item):
|
||||
return scrape(item, r'<li><a href="([^"]+)"[^>]+>([^<]+)(\d+)<br>', ['url', 'title', 'episode'], patron_block='<ul class="last" id="recentAddedEpisodesAnimeDDM">(.*?)</ul>' )
|
||||
|
||||
|
||||
def categorie(item):
|
||||
log()
|
||||
itemlist = []
|
||||
matches = support.match(item, r'<option value="([^"]+)">', r'<select name="genere" id="genere" class="selectInput">(.*?)</select>')[0]
|
||||
|
||||
for value in matches:
|
||||
url = item.url + value
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
contentType=item.contentType,
|
||||
action="peliculas",
|
||||
title=support.typo(value, 'bold'),
|
||||
url=url))
|
||||
return support.thumb(itemlist)
|
||||
|
||||
|
||||
def episodios(item):
|
||||
itemlist = scrape(item, r'<li><a href="([^"]+)"[^<]+<b>(.*?)<\/b>[^>]+>([^<]+)<\/i>', ['url','title','title2'], patron_block='<div class="seasonEp">(.*?)<div class="footer">')
|
||||
renumber(itemlist, item, 'bold')
|
||||
return itemlist
|
||||
|
||||
# da adattare... ( support.server ha vari parametri )
|
||||
#support.server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True)
|
||||
def findvideos(item):
|
||||
log()
|
||||
support.log()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r'\n|\t', ' ', data)
|
||||
data = re.sub(r'>\s\s*<', '><', data)
|
||||
patronBlock = r'LINK STREAMING(?P<block>.*?)LINK DOWNLOAD'
|
||||
patron = r'href="(.+?)"'
|
||||
block = scrapertoolsV2.find_single_match(data, patronBlock)
|
||||
urls = scrapertoolsV2.find_multiple_matches(block, patron)
|
||||
|
||||
if 'keepem.online' in data:
|
||||
urls = scrapertoolsV2.find_multiple_matches(data, r'(https://keepem\.online/f/[^"]+)"')
|
||||
for url in urls:
|
||||
url = httptools.downloadpage(url).url
|
||||
itemlist += servertools.find_video_items(data=url)
|
||||
for url in urls:
|
||||
|
||||
return support.server(item, data, itemlist)
|
||||
lang = ''
|
||||
if 'sub_ita' in url.lower():
|
||||
lang = 'Sub-ITA'
|
||||
else:
|
||||
lang = 'ITA'
|
||||
|
||||
if 'keepem.online' in data:
|
||||
urls = scrapertoolsV2.find_multiple_matches(data, r'(https://keepem\.online/f/[^"]+)"')
|
||||
for url in urls:
|
||||
url = httptools.downloadpage(url).url
|
||||
itemlist += servertools.find_video_items(data=url)
|
||||
|
||||
elif 'keepsetsu' in url.lower() or 'woof' in url.lower():
|
||||
if 'keepsetsu' in url.lower():
|
||||
support.log("keepsetsu url -> ", url )
|
||||
data = httptools.downloadpage(url).url
|
||||
support.log("LINK-DATA :", data)
|
||||
|
||||
data = httptools.downloadpage(data).data
|
||||
support.log("LINK-DATA2 :", data)
|
||||
video_urls = scrapertoolsV2.find_single_match(data, r'<meta name="description" content="([^"]+)"')
|
||||
|
||||
else:
|
||||
|
||||
data = httptools.downloadpage(url).data
|
||||
host_video = scrapertoolsV2.find_single_match(data, r'var thisPageUrl = "(http[s]\:\/\/[^\/]+).+?"')
|
||||
link = scrapertoolsV2.find_single_match(data, r'<video src="([^"]+)"')
|
||||
video_urls = host_video+link
|
||||
|
||||
title = support.typo(item.fulltitle,'_ bold') + support.typo(lang,'_ [] color kod')
|
||||
itemlist.append(
|
||||
support.Item(channel=item.channel,
|
||||
action="play",
|
||||
contentType=item.contentType,
|
||||
title=title,
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
url=video_urls,
|
||||
infoLabels=item.infoLabels,
|
||||
thumbnail=item.thumbnail,
|
||||
contentSerieName= item.contentSerieName,
|
||||
contentTitle=title,
|
||||
contentLanguage = 'ITA' if lang == [] else lang,
|
||||
args=item.args,
|
||||
server='directo',
|
||||
))
|
||||
return itemlist
|
||||
|
||||
Reference in New Issue
Block a user