fix: dreamsub

canale finito, da testare.
This commit is contained in:
greko17
2019-10-30 16:05:13 +01:00
parent e345b085ab
commit 11ae49e28b
2 changed files with 127 additions and 125 deletions

View File

@@ -7,5 +7,6 @@
"thumbnail": "dreamsub.png",
"banner": "dreamsub.png",
"categories": ["anime", "vos"],
"not_active": ["include_in_newest"],
"settings": []
}

View File

@@ -6,46 +6,49 @@
"""
Problemi noti che non superano il test del canale:
- indicare i problemi
- Nessuno noto!
Avvisi:
- Gli episodi sono divisi per pagine di 20
- In Novità->Anime, cliccare sulla home il bottone "Ultime inserite"
Avvisi per i tester:
1. Gli episodi sono divisi per pagine di 20
2. 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.
3.Passaggi per Aggiungere in videoteca e/o scaricare Serie:
1. sul titolo -> menu contestuale -> Rinumerazione
Solo dopo questo passaggio appariranno le voci, sul titolo -> menu contestuale ->:
- Aggiungi in videoteca (senza rinumerazione non appare
la voce)
- Scarica Serie e Scarica Stagione ( Se download Abilitato! )
Ulteriori info:
-
4. ### PIù IMPORTANTE!!! ###
#### NON E' DA CONSIDERARE ERRORE NEL TEST QUANTO RIPORTATO DI SEGUITO!!!! ####
1. Il sito permette un filtro tra anime e film, tramite url.
Se nell'url c'è /anime/, sul titolo e proseguendo fino alla pagina del video, saranno
presenti le voci:
- 'Rinumerazione', prima, e dopo: 'Aggiungi in videoteca', 'Scarica Serie' etc...
Tutto il resto è trattato come film e si avranno le voci solite:
AD eccezione per quei "FILM" che hanno 2 o più titoli all'interno, in questo caso:
1. Non apparirà nessuna voce tra "Aggiungi in videoteca" e "Scarica Film" e nemmeno "rinumerazione"
2. Dopo essere entrato nella pagina del Titolo Principale, troverai una lista di titoli dove sarà possibile scaricare
il filmato (chiamato EPISODIO) stessa cosa accedendo alla pagina ultima del video
3. Questi TITOLI NON POSSONO ESSERE AGGIUNTI IN VIDEOTECA
le voci "Scarica FILM" si avranno dopo.
Es:
https://www.dreamsub.stream/movie/5-centimetri-al-secondo -> film ma ha 3 titoli
Il Canale NON è presente nelle novità(globale) -> Anime
-------------------------------------------------------
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 copy
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 lib import unshortenit
##### fine import
__channel__ = "dreamsub"
@@ -53,7 +56,7 @@ host = config.get_channel_url(__channel__)
headers = [['Referer', host]]
# server di esempio...
list_servers = ['verystream', 'streamango', 'openload', 'directo']
list_servers = ['directo', 'verystream', 'streamango', 'openload']
# quality di esempio
list_quality = ['default']
@@ -63,19 +66,15 @@ list_quality = ['default']
def mainlist(item):
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']),
('Movie', ['/search/movie', 'peliculas', '', 'movie']),
('Film', ['/search/film', 'peliculas', '', 'movie']),
('Categorie', ['/filter?genere=','genres']),
## ('Ultimi Episodi', ['', 'last'])
]
"""
Eventuali Menu per voci non contemplate!
"""
return locals()
@@ -85,53 +84,37 @@ def peliculas(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">'
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>'
## 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>'
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">.+?Episodi[^>]+>.\s?(?P<nep>\d+).+?<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')
item = language(item)
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
if 'anime' in item.url:
item.contentType = 'tvshow'
item.action = 'episodios'
#item.args = 'anime'
else:
if item.nep == '1':
item.contentType = 'movie'
item.action = 'findvideos'
else:
item.contentType = 'episode'
item.args = ''
item.nep = item.nep
item.action = 'findmovie'
return item
#debug = True
@@ -140,36 +123,18 @@ def peliculas(item):
@support.scrape
def episodios(item):
support.log(item)
#dbg
anime = True
## item.contentType = 'episode'
#support.dbg()
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 = ''
patron = r'<li><a href="(?P<url>[^"]+)"[^<]+<b>(?:.+?)[ ](?P<episode>\d+)<\/b>[^>]+>(?P<title>[^<]+)<\/i>[ ]\(?(?P<lang1>ITA|Sub ITA)?\s?.?\s?(?P<lang2>Sub ITA)?.+?\)?<\/a>'
#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]'
item = language(item)
return item
pagination = ''
#debug = True
return locals()
@@ -177,6 +142,7 @@ def episodios(item):
def genres(item):
support.log(item)
#dbg
item.contentType = ''
action = 'peliculas'
blacklist = ['tutti']
@@ -187,15 +153,60 @@ def genres(item):
item.contentTitle = item.contentTitle.replace(' ', '+')
item.url = host+'/filter?genere='+item.contentTitle
return item
#debug = True
return locals()
@support.scrape
def findmovie(item):
support.log(item)
patronBlock = r'<div class="seasonEp">(?P<block>.*?)<div class="footer">'
item.contentType = 'episode'
item.nep = 2
patron = r'<li><a href="(?P<url>[^"]+)"[^>]+>.(?P<title2>.+?)-.+?-[ ]<b>(?P<title>.+?)</b>\s+\(?(?P<lang1>ITA)?\s?(?P<lang2>Sub ITA)?.+?\)?'
def itemHook(item):
item = language(item)
return item
#debug = True
return locals()
def language(item):
lang = []
if item.lang1:
if item.lang1.lower() == 'ita/jap' or item.lang1.lower() == 'ita':
lang.append('ITA')
if item.lang1.lower() == 'jap' and item.lang1.lower() == 'sub ita':
lang.append('Sub-ITA')
if item.lang2:
if item.lang2.lower() == 'sub ita':
lang.append('Sub-ITA')
item.contentLanguage = lang
if len(lang) ==2:
item.title += support.typo(lang[0], '_ [] color kod') + support.typo(lang[1], '_ [] color kod')
#item.show += support.typo(lang[0], '_ [] color kod') + support.typo(lang[1], '_ [] color kod')
elif len(lang) == 1:
item.title += support.typo(lang[0], '_ [] color kod')
#item.show += support.typo(lang[0], '_ [] color kod')
return item
def search(item, text):
support.log('search', item)
itemlist = []
text = text.replace(' ', '+')
item.url = host + '/search/' + text
item.contentType = item.contentType
item.args = 'search'
try:
return peliculas(item)
@@ -206,32 +217,11 @@ def search(item, text):
support.log('search log:', line)
return []
def newest(categoria):
support.log('newest ->', categoria)
itemlist = []
item = Item()
item.contentType = 'tvshow'
item.args = 'newest'
try:
item.url = host
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():
log('newest log: ', {0}.format(line))
return []
return itemlist
# da adattare... ( support.server ha vari parametri )
#support.server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True)
def findvideos(item):
support.log()
support.log("ITEM ---->", item)
itemlist = []
data = httptools.downloadpage(item.url).data
@@ -241,9 +231,10 @@ def findvideos(item):
patron = r'href="(.+?)"'
block = scrapertoolsV2.find_single_match(data, patronBlock)
urls = scrapertoolsV2.find_multiple_matches(block, patron)
#support.regexDbg(item, patron, headers, data=data)
for url in urls:
titles = item.infoLabels['title']
lang = ''
if 'sub_ita' in url.lower():
lang = 'Sub-ITA'
@@ -269,25 +260,35 @@ def findvideos(item):
else:
data = httptools.downloadpage(url).data
host_video = scrapertoolsV2.find_single_match(data, r'var thisPageUrl = "(http[s]\:\/\/[^\/]+).+?"')
#host_video = scrapertoolsV2.find_single_match(data, r'var thisPageUrl = "(http[s]\:\/\/[^\/]+).+?"')
host_video = scrapertoolsV2.find_single_match(data, r'let 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')
title_show = support.typo(titles,'_ bold') + support.typo(lang,'_ [] color kod')
itemlist.append(
support.Item(channel=item.channel,
action="play",
contentType=item.contentType,
title=title,
fulltitle=title,
show=title,
title=title_show,
fulltitle=item.fulltitle,
show=item.fulltitle,
url=video_urls,
infoLabels=item.infoLabels,
infoLabels = item.infoLabels,
thumbnail=item.thumbnail,
contentSerieName= item.contentSerieName,
contentTitle=title,
contentSerieName= item.fulltitle,
contentTitle=title_show,
contentLanguage = 'ITA' if lang == [] else lang,
args=item.args,
server='directo',
))
if item.contentType != 'episode' and int(item.nep) < 2 :
# Link Aggiungi alla Libreria
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findservers':
support.videolibrary(itemlist, item)
# link per scaricare
if config.get_setting('downloadenabled'):
support.download(itemlist, item)
return itemlist