Migliorato support.match e sostituito ove usato
- Fix Animeforce - Fix AnimeSubITA
This commit is contained in:
+91
-52
@@ -3,14 +3,11 @@
|
||||
# Canale per AnimeForce
|
||||
# ------------------------------------------------------------
|
||||
|
||||
from servers.decrypters import adfly
|
||||
from core import support
|
||||
|
||||
host = support.config.get_channel_url()
|
||||
|
||||
IDIOMAS = {'Italiano': 'IT'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_servers = ['directo', 'openload', 'vvvvid']
|
||||
list_servers = ['directo', 'vvvvid']
|
||||
list_quality = ['default']
|
||||
|
||||
|
||||
@@ -45,47 +42,40 @@ def newest(categoria):
|
||||
|
||||
return itemlist
|
||||
|
||||
@support.scrape
|
||||
def search(item, texto):
|
||||
# debug = True
|
||||
search = texto
|
||||
support.log(texto)
|
||||
item.args = 'noorder'
|
||||
item.url = host + '/?s=' + texto + '&cat=6010'
|
||||
item.contentType = 'tvshow'
|
||||
patron = r'<a href="(?P<url>[^"]+)">\s*<strong[^>]+>(?P<title>[^<]+)<'
|
||||
action = 'episodios'
|
||||
return locals()
|
||||
try:
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
|
||||
@support.scrape
|
||||
def peliculas(item):
|
||||
anime = True
|
||||
action = 'episodios'
|
||||
|
||||
if item.args == 'newest':
|
||||
patron = r'<a href="(?P<url>[^"]+)">\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
||||
action = 'findvideos'
|
||||
|
||||
elif item.args == 'last':
|
||||
patron = r'<a href="(?P<url>[^"]+)">\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
||||
|
||||
if not item.args:
|
||||
pagination = ''
|
||||
patron = r'<a\s*href="(?P<url>[^"]+)"\s*title="(?P<title>[^"]+)">'
|
||||
elif item.args == 'corso':
|
||||
pagination = ''
|
||||
patron = r'<strong><a href="(?P<url>[^"]+)">(?P<title>.*?) [Ss][Uu][Bb]'
|
||||
else:
|
||||
pagination = ''
|
||||
patron = r'<a href="(?P<url>[^"]+)">\s*<strong[^>]+>(?P<title>[^<]+)<'
|
||||
patron = r'<a href="(?P<url>[^"]+)"[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
||||
|
||||
if item.args == 'newest': item.action = 'findvideos'
|
||||
|
||||
def itemHook(item):
|
||||
if 'sub-ita' in item.url:
|
||||
if item.args != 'newest': item.title = item.title + support.typo('Sub-ITA','_ [] color kod')
|
||||
item.contentLanguage = 'Sub-ITA'
|
||||
if item.args == 'newest':
|
||||
url = support.match(item, '<a href="([^"]+)" title="[^"]+" target="[^"]+" class="btn', headers=headers)[0]
|
||||
item.url = url[0] if url else ''
|
||||
delete = support.scrapertools.find_single_match(item.fulltitle, r'( Episodi.*)')
|
||||
episode = support.scrapertools.find_single_match(item.title, r'Episodi(?:o)? (?:\d+÷)?(\d+)')
|
||||
item.title = support.typo(episode + ' - ','bold') + item.title.replace(delete,'')
|
||||
item.fulltitle = item.show = item.title.replace(delete,'')
|
||||
item.episode = episode
|
||||
return item
|
||||
|
||||
return locals()
|
||||
@@ -94,9 +84,15 @@ def peliculas(item):
|
||||
@support.scrape
|
||||
def episodios(item):
|
||||
anime = True
|
||||
patron = r'<td style[^>]+>\s*.*?(?:<span[^>]+)?<strong>(?P<title>[^<]+)<\/strong>.*?<td style[^>]+>\s*<a href="(?P<url>[^"]+)"[^>]+>'
|
||||
data = support.match(item, headers=headers).data
|
||||
if '<h6>Streaming</h6>' in data:
|
||||
patron = r'<td style[^>]+>\s*.*?(?:<span[^>]+)?<strong>(?P<title>[^<]+)<\/strong>.*?<td style[^>]+>\s*<a href="(?P<url>[^"]+)"[^>]+>'
|
||||
else:
|
||||
patron = r'<a\s*href="(?P<url>[^"]+)"\s*title="(?P<title>[^"]+)"\s*class="btn btn-dark mb-1">'
|
||||
def itemHook(item):
|
||||
item.url = item.url.replace(host, '')
|
||||
support.log(item)
|
||||
if item.url.startswith('//'): item.url= 'https:' + item.url
|
||||
elif item.url.startswith('/'): item.url= 'https:/' + item.url
|
||||
return item
|
||||
action = 'findvideos'
|
||||
return locals()
|
||||
@@ -104,38 +100,81 @@ def episodios(item):
|
||||
|
||||
def findvideos(item):
|
||||
support.log(item)
|
||||
|
||||
# try:
|
||||
# from urlparse import urljoin
|
||||
# except:
|
||||
# from urllib.parse import urljoin
|
||||
# support.dbg()
|
||||
itemlist = []
|
||||
|
||||
if item.episode:
|
||||
from lib import unshortenit
|
||||
url, c = unshortenit.unshorten(item.url)
|
||||
url = support.match(item, r'<a href="([^"]+)"[^>]*>', patronBlock=r'Episodio %s(.*?)</tr>' % item.episode ,url=url)[0]
|
||||
item.url = url[0] if url else ''
|
||||
|
||||
if 'vvvvid' in item.url:
|
||||
item.action = 'play'
|
||||
itemlist.append(item)
|
||||
import requests
|
||||
from lib import vvvvid_decoder
|
||||
|
||||
if support.match(item.url, string=True, patron=r'(\d+/\d+)').match:
|
||||
item.action = 'play'
|
||||
itemlist.append(item)
|
||||
else:
|
||||
# VVVVID vars
|
||||
vvvvid_host = 'https://www.vvvvid.it/vvvvid/ondemand/'
|
||||
vvvvid_headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0'}
|
||||
|
||||
if 'http' not in item.url:
|
||||
if '//' in item.url[:2]:
|
||||
item.url = 'http:' + item.url
|
||||
elif host not in item.url:
|
||||
item.url = host + item.url
|
||||
# VVVVID session
|
||||
current_session = requests.Session()
|
||||
login_page = 'https://www.vvvvid.it/user/login'
|
||||
conn_id = current_session.get(login_page, headers=vvvvid_headers).json()['data']['conn_id']
|
||||
payload = {'conn_id': conn_id}
|
||||
|
||||
|
||||
# collect parameters
|
||||
show_id = support.match(item.url, string=True, patron=r'(\d+)').match
|
||||
ep_number = support.match(item.title, patron=r'(\d+)').match
|
||||
json_file = current_session.get(vvvvid_host + show_id + '/seasons/', headers=vvvvid_headers, params=payload).json()
|
||||
season_id = str(json_file['data'][0]['season_id'])
|
||||
json_file = current_session.get(vvvvid_host + show_id + '/season/' + season_id +'/', headers=vvvvid_headers, params=payload).json()
|
||||
|
||||
# select the correct episode
|
||||
for episode in json_file['data']:
|
||||
support.log('Number',int(episode['number']),int(ep_number))
|
||||
if int(episode['number']) == int(ep_number):
|
||||
url = vvvvid_decoder.dec_ei(episode['embed_info'] or episode['embed_info'])
|
||||
if 'youtube' in url: item.url = url
|
||||
item.url = url.replace('manifest.f4m','master.m3u8').replace('http://','https://').replace('/z/','/i/')
|
||||
if 'https' not in item.url:
|
||||
url = support.match(item, url='https://or01.top-ix.org/videomg/_definst_/mp4:' + item.url + '/playlist.m3u')[1]
|
||||
url = url.split()[-1]
|
||||
itemlist.append(
|
||||
support.Item(action= 'play',
|
||||
url= 'https://or01.top-ix.org/videomg/_definst_/mp4:' + item.url + '/' + url,
|
||||
server= 'directo'))
|
||||
|
||||
elif 'adf.ly' in item.url:
|
||||
from servers.decrypters import adfly
|
||||
url = adfly.get_long_url(item.url)
|
||||
|
||||
if 'adf.ly' in item.url:
|
||||
item.url = adfly.get_long_url(item.url)
|
||||
elif 'bit.ly' in item.url:
|
||||
item.url = support.httptools.downloadpage(item.url, only_headers=True, follow_redirects=False).headers.get("location")
|
||||
url = support.httptools.downloadpage(item.url, only_headers=True, follow_redirects=False).headers.get("location")
|
||||
|
||||
else:
|
||||
url = host
|
||||
for u in item.url.split('/'):
|
||||
# support.log(i)
|
||||
if u and 'animeforce' not in u and 'http' not in u:
|
||||
url += '/' + u
|
||||
|
||||
if 'php?' in url:
|
||||
url = support.httptools.downloadpage(url, only_headers=True, follow_redirects=False).headers.get("location")
|
||||
url = support.match(url, patron=r'class="button"><a href=(?:")?([^" ]+)', headers=headers).match
|
||||
else:
|
||||
url = support.match(url, patron=[r'<source src=(?:")?([^" ]+)',r'name="_wp_http_referer" value="([^"]+)"']).match
|
||||
if url.startswith('//'): url = 'https:' + url
|
||||
elif url.startswith('/'): url = 'https:/' + url
|
||||
|
||||
matches = support.match(item, r'button"><a href="([^"]+)"')[0]
|
||||
|
||||
for video in matches:
|
||||
itemlist.append(
|
||||
support.Item(channel=item.channel,
|
||||
action="play",
|
||||
title='diretto',
|
||||
url=video,
|
||||
title='Diretto',
|
||||
url=url,
|
||||
server='directo'))
|
||||
|
||||
return support.server(item, itemlist=itemlist)
|
||||
|
||||
Reference in New Issue
Block a user