Skip to content

Commit

Permalink
[JP - NTVNEWS24] Fix live
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopa00 committed Oct 3, 2024
1 parent c68871d commit 6070edc
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions resources/lib/channels/jp/ntvnews24.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,30 @@
# noinspection PyUnresolvedReferences
from codequick import Resolver

import urlquick
import json

from resources.lib import resolver_proxy, web_utils

# TODO
# Add Videos, Replays ?

# URL_ROOT = 'http://www.news24.jp'
# URL_LIVE = URL_ROOT + '/livestream/'
URL_LIVE = 'https://news.ntv.co.jp/live'
video_url = 'https://n24-cdn-live.ntv.co.jp/ch01/index.m3u8'
URL_ROOT = 'https://news.ntv.co.jp'
URL_LIVE = URL_ROOT + '/live'
URL_TOKEN = URL_ROOT + '/api/generate-pta'
VIDEO_LIVE = 'https://n24-cdn-live-x.ntv.co.jp/ch01/index.m3u8'


@Resolver.register
def get_live_url(plugin, item_id, **kwargs):
return resolver_proxy.get_stream_with_quality(plugin, video_url, manifest_type="hls")
headers = {
'referer': URL_LIVE,
'User-Agent': web_utils.get_random_ua()
}

resp = urlquick.get(URL_TOKEN, headers=headers, max_age=-1)
json_parser = json.loads(resp.text)
pta = json_parser['pta']
video_url = VIDEO_LIVE + '?pta=%s' % pta

return resolver_proxy.get_stream_with_quality(plugin, video_url)

0 comments on commit 6070edc

Please sign in to comment.