- Fix AnimeWorld

- Nuovo Canale Paramount Network
This commit is contained in:
Alhaziel01
2021-01-16 12:37:37 +01:00
parent 0075f61d6c
commit 4a5dca826e
5 changed files with 125 additions and 88 deletions
+2 -9
View File
@@ -201,22 +201,15 @@ def findvideos(item):
if match: if match:
epID, epurl = match epID, epurl = match
if 'vvvvid' in name.lower(): if 'vvvvid' in name.lower():
urls.append(support.match(host + '/api/episode/serverPlayer?id=' + epID, headers=headers, patron=r'<a.*?href="([^"]+)"').match) urls.append(support.match(host + '/api/episode/ugly/serverPlayerAnimeWorld?id=' + epID, headers=headers, patron=r'<a.*?href="([^"]+)"').match)
elif 'animeworld' in name.lower(): elif 'animeworld' in name.lower():
url = support.match(data, patron=r'href="([^"]+)"\s*id="alternativeDownloadLink"', headers=headers).match url = support.match(data, patron=r'href="([^"]+)"\s*id="alternativeDownloadLink"', headers=headers).match
title = support.match(url, patron=r'http[s]?://(?:www.)?([^.]+)', string=True).match title = support.match(url, patron=r'http[s]?://(?:www.)?([^.]+)', string=True).match
itemlist.append(item.clone(action="play", title=title, url=url, server='directo')) itemlist.append(item.clone(action="play", title=title, url=url, server='directo'))
# elif 'server 2' in name.lower():
# dataJson = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).data
# json = jsontools.load(dataJson)
# title = support.match(json['grabber'], patron=r'server2.([^.]+)', string=True).match
# itemlist.append(item.clone(action="play", title=title, url=json['grabber'], server='directo'))
else: else:
dataJson = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).data dataJson = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).data
json = jsontools.load(dataJson) json = jsontools.load(dataJson)
title = support.match(json['grabber'], patron=r'server2.([^.]+)', string=True).match title = support.match(json['grabber'], patron=r'server\d+.([^.]+)', string=True).match
if title: itemlist.append(item.clone(action="play", title=title, url=json['grabber'].split('=')[-1], server='directo')) if title: itemlist.append(item.clone(action="play", title=title, url=json['grabber'].split('=')[-1], server='directo'))
else: itemlist.append(item.clone(action="play", title=name, url=json['grabber'], server=name)) else: itemlist.append(item.clone(action="play", title=name, url=json['grabber'], server=name))
# for item in itemlist:
# support.logger.debug(item.url)
return support.server(item, urls, itemlist) return support.server(item, urls, itemlist)
+2 -12
View File
@@ -1,22 +1,12 @@
{ {
"id": "paramount", "id": "paramount",
"name": "Paramount Network", "name": "Paramount Network",
"active": false, "active": true,
"language": ["ita"], "language": ["ita"],
"thumbnail": "paramount.png", "thumbnail": "paramount.png",
"banner": "paramount.png", "banner": "paramount.png",
"categories": ["movie", "tvshow", "documentary", "live"], "categories": ["movie", "tvshow", "documentary", "live"],
"not_active": ["include_in_newest"], "not_active": ["include_in_newest"],
"default_off": ["include_in_global_search"], "default_off": ["include_in_global_search"],
"settings": [ "settings": []
{
"id": "pagination",
"type": "list",
"label": "Elementi per pagina",
"default": 1,
"enabled": true,
"visible": true,
"lvalues": ["20", "40", "60", "80", "100"]
}
]
} }
+45 -65
View File
@@ -2,9 +2,9 @@
# ------------------------------------------------------------ # ------------------------------------------------------------
# Canale per Paramount Network # Canale per Paramount Network
# ------------------------------------------------------------ # ------------------------------------------------------------
import inspect
from core import support, jsontools from core import support, jsontools
from platformcode import autorenumber from platformcode import autorenumber, logger
# host = support.config.get_channel_url() # host = support.config.get_channel_url()
host = 'https://www.paramountnetwork.it' host = 'https://www.paramountnetwork.it'
@@ -13,9 +13,9 @@ headers = [['Referer', host]]
@support.menu @support.menu
def mainlist(item): def mainlist(item):
top = [('Dirette {bold}', ['/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json', 'live'])] top = [('Dirette {bold}', ['', 'live'])]
film = [] film = ['/film']
tvshow = [] tvshow = ['/programmi']
return locals() return locals()
@support.scrape @support.scrape
@@ -27,20 +27,21 @@ def menu(item):
def search(item, text): def search(item, text):
support.info(text) logger.info(text)
item.search = text.replace(' ','+') item.text = text
try: try:
return peliculas(item) return peliculas(item)
# Continua la ricerca in caso di errore . # Continua la ricerca in caso di errore .
except: except:
import sys import sys
for line in sys.exc_info(): for line in sys.exc_info():
support.logger.error("%s" % line) logger.error("%s" % line)
return [] return []
def live(item): def live(item):
logger.debug()
itemlist=[] itemlist=[]
urls=[] urls=[]
matches = support.match(host, patron=r'(/diretta-tv/[^"]+)"[^>]+>([^ ]+)').matches matches = support.match(host, patron=r'(/diretta-tv/[^"]+)"[^>]+>([^ ]+)').matches
@@ -56,60 +57,46 @@ def live(item):
info = jsontools.load(support.match(host +'/api/on-air?channelId=' + ch_dict[title]).data) info = jsontools.load(support.match(host +'/api/on-air?channelId=' + ch_dict[title]).data)
support.info(info) support.info(info)
plot= '[B]' + info['seriesTitle'] +'[/B]\n' + info['description'] if 'seriesTitle' in info else '' plot= '[B]' + info['seriesTitle'] +'[/B]\n' + info['description'] if 'seriesTitle' in info else ''
itemlist.append(item.clone(title=support.typo(title,'bold'), contentTitle=title, url=host+url, plot=plot, action='findvideos')) itemlist.append(item.clone(title=support.typo(title,'bold'), contentTitle=title, fulltitle=title, show=title, url=host+url, plot=plot, action='play', forcethumb=True))
return itemlist return support.thumb(itemlist, live=True)
def peliculas(item): def peliculas(item):
logger.debug()
def load_more(url):
second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('%5C','/')
new_data = support.match(host + second_url).data.replace('\x01','l').replace('\x02','a')
return jsontools.load(new_data)['items']
itemlist = [] itemlist = []
if item.contentType == 'movie': data = []
Type = 'Movie' page_data = support.match(item.url).data
action = 'findvideos' more = support.match(page_data, patron=r'loadingTitle":[^,]+,"url":"([^"]+)"').match
else: data = jsontools.load(support.scrapertools.decodeHtmlentities(support.match(page_data, patron=[r'"nextPageUrl":[^,]+,"items":(.*?),"customContainerClass"', r'Streaming"},"items":(.*?),"isGrid"']).match))
Type = 'Series'
action = 'episodios' if data:
if not item.page: item.page = 1 if more:
pagination_values = [20, 40, 60, 80, 100] new_data = load_more(more)
pagination = pagination_values[support.config.get_setting('pagination','paramount')] data += new_data
item.url = host + '/api/search?activeTab=' + Type + '&searchFilter=site&pageNumber=0&rowsPerPage=10000'
data = jsontools.load(support.match(item).data)['response']['items']
titles = []
for it in data: for it in data:
title = it['meta']['header']['title'] title = it['meta']['header']['title']
if title not in titles: if item.text.lower() in title.lower():
titles.append(title)
d = it['meta']['date'].split('/') if it['meta']['date'] else ['0000','00','00']
date = int(d[2] + d[1] + d[0])
if item.search.lower() in title.lower() \
and 'stagione' not in it['url'] \
and 'season' not in it['url'] \
and title not in ['Serie TV']:
itemlist.append( itemlist.append(
item.clone(title=support.typo(title,'bold'), item.clone(title=support.typo(title,'bold'),
action=action, fulltitle = title,
fulltitle=title, show = title,
show=title, contentTitle = title if item.contentType == 'movie' else '',
contentTitle=title if it['type'] == 'movie' else '', contentSerieName = title if item.contentType != 'movie' else '',
contentSerieName=title if it['type'] != 'movie' else '', url = host + it['url'] if it['url'].startswith('/') else it['url'],
plot= it['meta']['description'] if 'description' in it['meta'] else '', thumbnail = it['media']['image']['url'],
url=host + it['url'], fanart = it['media']['image']['url'],
date=date, plot = it['meta']['description'],
thumbnail='https:' + it['media']['image']['url'] if 'url' in it['media']['image'] else item.thumbnail)) action = 'findvideos' if item.contentType == 'movie' else 'episodios'))
itemlist.sort(key=lambda item: item.fulltitle)
if not item.search:
itlist = []
for i, it in enumerate(itemlist):
if pagination and (item.page - 1) * pagination > i and not item.search: continue # pagination
if pagination and i >= item.page * pagination and not item.search: break # pagination
itlist.append(it)
if pagination and len(itemlist) >= item.page * pagination and not item.search:
itlist.append(item.clone(channel=item.channel, action = 'peliculas', title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), page=item.page + 1, thumbnail=support.thumb()))
itemlist = itlist
autorenumber.start(itemlist)
return itemlist return itemlist
def episodios(item): def episodios(item):
logger.debug()
def load_more(url): def load_more(url):
second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('%5C','/') second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('%5C','/')
new_data = support.match(host + second_url).data new_data = support.match(host + second_url).data
@@ -121,7 +108,7 @@ def episodios(item):
page_data = support.match(item.url).data page_data = support.match(item.url).data
seasons = support.match(page_data, patron=r'href="([^"]+)"[^>]+>Stagione\s*\d+').matches seasons = support.match(page_data, patron=r'href="([^"]+)"[^>]+>Stagione\s*\d+').matches
more = support.match(page_data, patron=r'loadingTitle":[^,]+,"url":"([^"]+)"').match more = support.match(page_data, patron=r'loadingTitle":[^,]+,"url":"([^"]+)"').match
data = jsontools.load(support.scrapertools.decodeHtmlentities(support.match(page_data, patron=r'"isEpisodes":[^,]+,"items":(.*?),"as"').match)) data = jsontools.load(support.scrapertools.decodeHtmlentities(support.match(page_data, patron=r'"isEpisodes":[^,]+,"items":(.*?),"isKidsUI"').match))
if data: if data:
if more: if more:
@@ -129,7 +116,7 @@ def episodios(item):
if seasons: if seasons:
for url in seasons: for url in seasons:
new_data = support.match(host + url).data new_data = support.match(host + url).data
data += jsontools.load(support.scrapertools.decodeHtmlentities(support.match(new_data, patron=r'isEpisodes":[^,]+,"items":(.*?),"as"').match.replace('\x01','l').replace('\x02','a'))) data += jsontools.load(support.scrapertools.decodeHtmlentities(support.match(new_data, patron=r'isEpisodes":[^,]+,"items":(.*?),"isKidsUI"').match.replace('\x01','l').replace('\x02','a')))
match = support.match(new_data, patron=r'loadingTitle":[^,]+,"url":"([^"]+)"').match match = support.match(new_data, patron=r'loadingTitle":[^,]+,"url":"([^"]+)"').match
if match and match != load_more: if match and match != load_more:
data += load_more(match) data += load_more(match)
@@ -162,17 +149,10 @@ def episodios(item):
def findvideos(item): def findvideos(item):
itemlist = [] logger.debug()
qualities = [] return support.server(item, item.url, Download=False)
mgid = support.match(item, patron=r'uri":"([^"]+)"').match
url = 'https://media.mtvnservices.com/pmt/e1/access/index.html?uri=' + mgid + '&configtype=edge&ref=' + item.url def play(item):
ID, rootUrl = support.match(url, patron=[r'"id":"([^"]+)",',r'brightcove_mediagenRootURL":"([^"]+)"']).matches logger.debug()
url = jsontools.load(support.match(rootUrl.replace('&device={device}','').format(uri = ID)).data)['package']['video']['item'][0]['rendition'][0]['src'] return support.servertools.find_video_items(item, data=item.url)
video_urls = support.match(url, patron=r'RESOLUTION=(\d+x\d+).*?(http[^ ]+)').matches
for quality, url in video_urls:
if quality not in qualities:
qualities.append(quality)
itemlist.append(item.clone(title=support.config.get_localized_string(30137), server='directo', action='play', url=url, quality=quality, focusOnVideoPlayer=True))
itemlist.sort(key=lambda item: item.quality)
return support.server(item, itemlist=itemlist, Download=False)
+41
View File
@@ -0,0 +1,41 @@
{
"active": true,
"find_videos": {
"ignore_urls": [],
"patterns": [
{
"pattern": "paramountnetwork.it/([^/]+/[A-Za-z0-9]+)",
"url": "https://www.paramountnetwork.it/\\1"
}
]
},
"free": true,
"id":"paramount_server",
"name": "Paramount",
"settings": [
{
"default": false,
"enabled": true,
"id": "black_list",
"label": "@70708",
"type": "bool",
"visible": true
},
{
"default": 0,
"enabled": true,
"id": "favorites_servers_list",
"label": "@60655",
"lvalues": [
"No",
"1",
"2",
"3",
"4",
"5"
],
"type": "list",
"visible": false
}
]
}
+33
View File
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from core import httptools, support, jsontools
from platformcode import config, logger
def test_video_exists(page_url):
global data
logger.debug('page url=', page_url)
response = httptools.downloadpage(page_url)
if response.code == 404:
return False, config.get_localized_string(70449) % 'Paramount'
else:
data = response.data
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
qualities = []
video_urls = []
mgid = support.match(data, patron=r'uri":"([^"]+)"').match
url = 'https://media.mtvnservices.com/pmt/e1/access/index.html?uri=' + mgid + '&configtype=edge&ref=' + page_url
ID, rootUrl = support.match(url, patron=[r'"id":"([^"]+)",',r'brightcove_mediagenRootURL":"([^"]+)"']).matches
url = jsontools.load(support.match(rootUrl.replace('&device={device}','').format(uri = ID)).data)['package']['video']['item'][0]['rendition'][0]['src']
urls = support.match(url, patron=r'RESOLUTION=(\d+x\d+).*?(http[^ ]+)').matches
for quality, url in urls:
if quality not in qualities:
qualities.append(quality)
video_urls.append(["m3u8 {}p [Paramount]".format(quality.split('x')[-1]), url])
video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match))
return video_urls