Skip to content

Commit

Permalink
[FR - FRANCETV] Fix live error (#1460)
Browse files Browse the repository at this point in the history
* [FR - FRANCETV] Fix live error

* [FR - FRANCETV] Fix live franceinfo
  • Loading branch information
jeff2900 authored Jan 29, 2025
1 parent 8399117 commit a052c3a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions resources/lib/channels/fr/francetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,19 @@ def get_video_url(plugin,

@Resolver.register
def get_live_url(plugin, item_id, **kwargs):

if item_id in ('spectacles-et-culture', 'france-2', 'france-3', 'france-4', 'france-5', 'franceinfo', 'paris-h24'):
resp = urlquick.get(URL_LIVE % item_id, headers={'User-Agent': web_utils.get_random_windows_ua()}, max_age=-1)
broadcast_id = re.compile(r'videoId\"\:\"(.*?)\"', re.DOTALL).findall(resp.text)[0]
return resolver_proxy.get_francetv_live_stream(plugin, broadcast_id)
resp = urlquick.get('https://www.france.tv', headers={'User-Agent': web_utils.get_random_windows_ua()}, max_age=-1)
link_chunks = re.compile(r'script src="(/_next/static/chunks/6289-.*?\.js)" async').findall(resp.text)
if link_chunks:
url_chunks = 'https://www.france.tv' + link_chunks[0]
else:
url_chunks = 'https://www.france.tv/_next/static/chunks/6289-a967d224c6406ad2.js'

resp = urlquick.get(url_chunks, headers={'User-Agent': web_utils.get_random_windows_ua()}, max_age=-1)
chunk = re.compile(r'([A-Za-z0-9-"]+?):{label:"(.+?)",playerId:"(\w+?-\w+?-\w+?-\w+?-\w+?)"}').findall(resp.text)
for channels_id, channels_label, broadcast_id in chunk:
channel_id = channels_id.strip('\"')
if item_id == channel_id:
return resolver_proxy.get_francetv_live_stream(plugin, broadcast_id)

broadcast_id = 'SIM_France%s'
return resolver_proxy.get_francetv_live_stream(plugin, broadcast_id % item_id.split('-')[1])

0 comments on commit a052c3a

Please sign in to comment.