Fix Pluto TV
This commit is contained in:
@@ -3,23 +3,15 @@
|
||||
# Canale per Pluto TV
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import uuid, datetime, requests
|
||||
import uuid, datetime
|
||||
from platformcode import logger, config
|
||||
from core.item import Item
|
||||
from core import support, httptools
|
||||
|
||||
|
||||
host = support.config.get_channel_url()
|
||||
|
||||
api = 'https://api.pluto.tv'
|
||||
UUID = 'sid={}&deviceId={}'.format(uuid.uuid1().hex, uuid.uuid4().hex)
|
||||
|
||||
now = datetime.datetime.now()
|
||||
start = (now.strftime('%Y-%m-%dT%H:00:00Z'))
|
||||
stop = (now + datetime.timedelta(hours=2)).strftime('%Y-%m-%dT%H:00:00Z')
|
||||
|
||||
|
||||
live_url = '{}/v2/channels.json?{}'.format(api, UUID)
|
||||
guide_url = '{}/v2/channels?start={}&stop={}&{}'.format(api, start, stop, UUID)
|
||||
vod_url = '{}/v3/vod/categories?includeItems=true&deviceType=web&'.format(api, UUID)
|
||||
|
||||
|
||||
@@ -33,31 +25,36 @@ def mainlist(item):
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
def live(item):
|
||||
logger.debug()
|
||||
def calcTime(t):
|
||||
return datetime.datetime.strftime(datetime.datetime.strptime(t, '%Y-%m-%dT%H:%M:%S.%fZ'), '%H:%M')
|
||||
|
||||
guide = {}
|
||||
for g in httptools.downloadpage(guide_url).json:
|
||||
guide[g['number']] = [g['timelines'][0]['title'],
|
||||
'{}/{}'.format(calcTime(g['timelines'][0]['start']), calcTime(g['timelines'][0]['stop'])),
|
||||
g['timelines'][1]['title']]
|
||||
now = datetime.datetime.now()
|
||||
start = (now.strftime('%Y-%m-%dT%H:00:00Z'))
|
||||
stop = (now + datetime.timedelta(hours=2)).strftime('%Y-%m-%dT%H:00:00Z')
|
||||
|
||||
|
||||
live_url = '{}/v2/channels.json?{}'.format(api, UUID)
|
||||
guide_url = '{}/v2/channels?start={}&stop={}&{}'.format(api, start, stop, UUID)
|
||||
|
||||
guide = {g['number']:[g['timelines'][0]['title'], g['timelines'][1]['title']] for g in httptools.downloadpage(guide_url).json}
|
||||
|
||||
itemlist = []
|
||||
|
||||
for it in httptools.downloadpage(live_url).json:
|
||||
itemlist.append(item.clone(title= '[B]{}[/B] | {} | {}'.format(it['name'], guide[it['number']][0], guide[it['number']][1]),
|
||||
itemlist.append(item.clone(title= '[B]{}[/B] | {}'.format(it['name'], guide[it['number']][0]),
|
||||
number=it['number'],
|
||||
contentTitle=it['name'],
|
||||
action='findvideos',
|
||||
thumbnail=it['solidLogoPNG']['path'],
|
||||
fanart=it['featuredImage']['path'],
|
||||
plot='{}\n\n[B]A seguire:[/B]\n{}'.format(it['summary'], guide[it['number']][2]),
|
||||
url= it['stitched']['urls'][0]['url'],
|
||||
plot='{}\n\n[B]A seguire:[/B]\n{}'.format(it['summary'], guide[it['number']][1]),
|
||||
videourl= it['stitched']['urls'][0]['url'].split('?')[0],
|
||||
forcethumb=True))
|
||||
itemlist.sort(key=lambda it: it.number)
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, text):
|
||||
logger.debug('Search', text)
|
||||
try:
|
||||
@@ -81,6 +78,7 @@ def peliculas(item):
|
||||
for i, it in enumerate(item.args):
|
||||
if item.search in it['name'].lower():
|
||||
itm = Item(channel=item.channel,
|
||||
url=item.url,
|
||||
title=it['name'],
|
||||
contentTitle=it['name'],
|
||||
contentSerieName= it['name'] if it['type'] == 'series' else '',
|
||||
@@ -90,7 +88,7 @@ def peliculas(item):
|
||||
thumbnail= it['covers'][0]['url'],
|
||||
fanart= it['covers'][2]['url'] if len(it['covers']) > 2 else '',
|
||||
id= it['_id'],
|
||||
url= it['stitched']['urls'][0]['url'])
|
||||
videourl= it['stitched']['urls'][0]['url'].split('?')[0])
|
||||
|
||||
if i < 20 or item.search:
|
||||
itemlist.append(itm)
|
||||
@@ -115,7 +113,7 @@ def episodios(item):
|
||||
contentEpisodeNumber=episode['number'],
|
||||
plot=episode['description'],
|
||||
thumbnail=episode['covers'][1]['url'],
|
||||
url=episode['stitched']['urls'][0]['url'],
|
||||
videourl=episode['stitched']['urls'][0]['url'].split('?')[0],
|
||||
action='findvideos'))
|
||||
|
||||
if config.get_setting('episode_info'):
|
||||
@@ -125,13 +123,8 @@ def episodios(item):
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
item.server = 'directo'
|
||||
item.manifest='hls'
|
||||
item.url = item.url.replace('deviceType=&','deviceType=web&')
|
||||
item.url = item.url.replace('deviceMake=&','deviceMake=firefox&')
|
||||
item.url = item.url.replace('deviceModel=&','deviceModel=firefox&')
|
||||
item.url = item.url.replace('appName=&','appName=web&')
|
||||
item.url = item.url.replace('sid=&','')
|
||||
item.url = '{}&sid={}'.format(item.url, uuid.uuid1().hex)
|
||||
params = '{}?deviceDNT=0&deviceVersion=unknow&appVersion=unknow&deviceType=web&deviceMake=firefox&deviceModel=firefox&appName=web&{}'
|
||||
item.url = params.format(item.videourl, UUID)
|
||||
return support.server(item, itemlist=[item], Download=False, Videolibrary=False)
|
||||
|
||||
Reference in New Issue
Block a user