Skip to content

Commit

Permalink
[FR - LEQUIPE] Fix multi-lives
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopa00 committed Nov 18, 2023
1 parent 6395159 commit 56a5cac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
46 changes: 20 additions & 26 deletions resources/lib/channels/fr/lequipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,35 +84,29 @@ def list_videos(plugin, item_id, program_url, page, **kwargs):
@Resolver.register
def get_video_url(plugin, item_id, video_id, download_mode=False, **kwargs):

return resolver_proxy.get_stream_dailymotion(plugin, video_id, download_mode)
embeder = EMBEDER_URL % video_id
return resolver_proxy.get_stream_dailymotion(plugin, video_id, download_mode, embeder)


@Resolver.register
def get_live_url(plugin, item_id, **kwargs):
resp = urlquick.get(URL_LIVE, headers=GENERIC_HEADERS, max_age=-1)
root = resp.parse()

list_url = []
list_channel = []

try:
video_list = root.find('.//div[@class="RemoteVideoListWidget"]')
for link in video_list.findall('.//a[@class="Link"]'):
url = re.compile(r'live\/(.*?)$').findall(link.get('href'))[0]
channel = link.find('.//img').get('alt')
list_url.append(url)
list_channel.append(channel)

except Exception:
list_channel.append("La chaine l'Équipe")
list_url.append('x2lefik')

if item_id == 'lequipelive':
ret = xbmcgui.Dialog().select(Script.localize(30174), list_channel)
else:
ret = 0
return resolver_proxy.get_stream_dailymotion(plugin, 'x2lefik', False, EMBEDER_URL % 'x2lefik')

live_id = list_url[ret]
embeder = EMBEDER_URL % live_id

return resolver_proxy.get_stream_dailymotion(plugin, live_id, False, embeder)
@Route.register
def get_multi_live_url(plugin, item_id, **kwargs):
resp = urlquick.get(URL_LIVE, headers=GENERIC_HEADERS, max_age=-1)
root = resp.parse()
for video_list in root.iterfind('.//a[@class="Link"]'):
item = Listitem()
for div_title in video_list.iterfind('.//div'):
if div_title is not None and div_title.get('class') == "ArticleTags__items js-ob-internal-reco":
for d_title in div_title.iterfind('.//div[@class="ArticleTags__item"]'):
if 'font' not in d_title.get('style'):
item.label = d_title.text
item.info['plot'] = video_list.find('.//h2[@class="ColeaderWidget__title"]').text
item.art["thumb"] = item.art["thumb"] = video_list.find(".//img").get('src')
video_id = re.compile(r'live\/(.*?)$').findall(video_list.get('href'))[0]
item.set_callback(get_video_url, item_id, video_id=video_id)
item_post_treatment(item)
yield item
2 changes: 1 addition & 1 deletion resources/lib/skeletons/fr_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@
'order': 75
},
'lequipelive': {
'resolver': '/resources/lib/channels/fr/lequipe:get_live_url',
'route': '/resources/lib/channels/fr/lequipe:get_multi_live_url',
'label': 'L\'Equipe Live',
'thumb': 'channels/fr/lequipelive.png',
'fanart': 'channels/fr/lequipelive_fanart.png',
Expand Down

0 comments on commit 56a5cac

Please sign in to comment.