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