Skip to content

Commit

Permalink
[FR - CNEWS] Fix replay
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopa00 committed Dec 14, 2024
1 parent c465af1 commit 4317df7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions resources/lib/channels/fr/cnews.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def list_categories(plugin, item_id, **kwargs):

@Route.register
def list_videos(plugin, item_id, category_url, page, **kwargs):
resp = urlquick.get(category_url % page, headers=GENERIC_HEADERS, verify=False, max_age=-1)
resp = urlquick.get(category_url % page, headers=GENERIC_HEADERS, max_age=-1)
parser = htmlement.HTMLement()
parser.feed(resp.json())
data = parser.close()
Expand All @@ -82,13 +82,13 @@ def get_video_id(plugin, video_id, download_mode=False, **kwargs):

@Route.register
def list_emissions(plugin, item_id, category_url, page, **kwargs):
resp = urlquick.get(URL_REPLAY_CNEWS, headers=GENERIC_HEADERS, verify=False, max_age=-1)
resp = urlquick.get(URL_REPLAY_CNEWS, headers=GENERIC_HEADERS, max_age=-1)
data = resp.parse("div", attrs={"class": "les-emissions"})

for video_datas in data.iterfind(".//a[@class='emission-item-wrapper']"):
item = Listitem()
item.label = video_datas.find(".//div[@class='field field-type-text']").text
video_image = video_datas.find('.//img').get('data-echo')
item.label = video_datas.find(".//div[@class='emission-name']").text
video_image = video_datas.find('.//img').get('data-src')
video_url = URL_ROOT_SITE + video_datas.get('href')
item.art['thumb'] = item.art['landscape'] = video_image

Expand All @@ -106,8 +106,8 @@ def list_emissions_old(plugin, item_id, category_url, page, **kwargs):

for video_datas in data.iterfind(".//a[@class='emission-item-wrapper']"):
item = Listitem()
item.label = video_datas.find(".//div[@class='field field-type-text']").text
video_image = video_datas.find('.//img').get('data-echo')
item.label = video_datas.find(".//div[@class='emission-name']").text
video_image = video_datas.find('.//img').get('data-src')
video_url = URL_ROOT_SITE + video_datas.get('href')
item.art['thumb'] = item.art['landscape'] = video_image

Expand All @@ -121,7 +121,7 @@ def list_emissions_old(plugin, item_id, category_url, page, **kwargs):

@Route.register
def list_videos_emission(plugin, item_id, video_url, **kwargs):
resp = urlquick.get(video_url, headers=GENERIC_HEADERS, verify=False, max_age=-1)
resp = urlquick.get(video_url, headers=GENERIC_HEADERS, max_age=-1)
root = resp.parse()

info = root.findall(".//p")[0].text
Expand Down Expand Up @@ -153,16 +153,15 @@ def list_videos_emission(plugin, item_id, video_url, **kwargs):

@Resolver.register
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):
root = urlquick.get(video_url, headers=GENERIC_HEADERS, verify=False, max_age=-1).parse()
root = urlquick.get(video_url, headers=GENERIC_HEADERS, max_age=-1).parse()
video_id = root.find(".//div[@id='embed-main-video']").get('data-videoid')
# video_id = re.compile(r'data-videoid\"\=\"(.*?)[\?\"]').findall(resp.text)[0]

return resolver_proxy.get_stream_dailymotion(plugin, video_id, download_mode)


@Resolver.register
def get_live_url(plugin, item_id, **kwargs):
root = urlquick.get(URL_LIVE_CNEWS, headers=GENERIC_HEADERS, verify=False, max_age=-1).parse()
root = urlquick.get(URL_LIVE_CNEWS, headers=GENERIC_HEADERS, max_age=-1).parse()
try:
live_id = root.find(".//div[@data-muted='true']").get('data-videoid')
except Exception:
Expand Down

0 comments on commit 4317df7

Please sign in to comment.