Skip to content

Commit

Permalink
[MA - M24] Fix live
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopa00 committed Nov 26, 2024
1 parent 000f461 commit 762094a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions resources/lib/channels/ma/m24.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@

from resources.lib import resolver_proxy, web_utils

URL_LIVES = 'http://www.m24tv.ma/'
URL_LIVE = 'https://www.m24tv.ma/'
DIRECT_URL_LIVE = 'https://63df3191463ce.streamlock.net/live/ngrp:Live2.stream_all/playlist.m3u8'

GENERIC_HEADERS = {'User-Agent': web_utils.get_random_windows_ua()}


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

resp = urlquick.get(URL_LIVES)
video_url = re.compile(r'Direct\ TV[\S\s]*\"file\"\:\ \"(.*\.m3u8.*)\"\,').findall(resp.text)[0]
try:
resp = urlquick.get(URL_LIVE, headers=GENERIC_HEADERS, max_age=-1)
video_url = re.compile(r'\"file\"\:\ \"(.*\.m3u8.*)\"\,').findall(resp.text)[0]

except Exception:
video_url = DIRECT_URL_LIVE

return resolver_proxy.get_stream_with_quality(plugin, video_url, manifest_type="hls")
return resolver_proxy.get_stream_with_quality(plugin, video_url)

0 comments on commit 762094a

Please sign in to comment.