Skip to content

Commit

Permalink
[FR - VIAMATELE] Fix live and use its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopa00 committed Oct 5, 2024
1 parent 7a77e3d commit 7129309
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
7 changes: 0 additions & 7 deletions resources/lib/channels/fr/via.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

URL_LIVE = URL_ROOT + '/direct-tv/'

URL_LIVE_MATELE = URL_ROOT + '/direct-2'

URL_ROOT_VIAVOSGES = 'https://www.viavosges.tv'

URL_LIVE_VIAVOSGES = URL_ROOT_VIAVOSGES + '/Direct.html'
Expand Down Expand Up @@ -99,11 +97,6 @@ def get_live_url(plugin, item_id, **kwargs):
video_url = json.loads(resp.text)["files"]["auto"]
return resolver_proxy.get_stream_with_quality(plugin, video_url=video_url, manifest_type='mpd')

if item_id == 'matele':
live_html = urlquick.get(URL_LIVE_MATELE % item_id, headers=GENERIC_HEADERS, max_age=-1)
video_url = live_html.parse("div", attrs={"class": "mvp-playlist-item"}).get('data-path')
return resolver_proxy.get_stream_with_quality(plugin, video_url)

live_html = urlquick.get(URL_LIVE % item_id, headers=GENERIC_HEADERS, max_age=-1)

root = live_html.parse()
Expand Down
32 changes: 32 additions & 0 deletions resources/lib/channels/fr/via_matele.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2024, Joaopa
# GNU General Public License v2.0+ (see LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt)

# This file is part of Catch-up TV & More

from __future__ import unicode_literals
import re

from codequick import Resolver, Route
import urlquick

from resources.lib import resolver_proxy, web_utils


# TODO Add replays

URL_ROOT = 'https://matele.tv'

URL_LIVE = URL_ROOT + '/direct'

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


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

resp = urlquick.get(URL_LIVE, headers=GENERIC_HEADERS, max_age=-1)
root = resp.text
video_url = re.compile(r"source:\'(.*?)\'").findall(root)[0]

return resolver_proxy.get_stream_with_quality(plugin, video_url)
2 changes: 1 addition & 1 deletion resources/lib/skeletons/fr_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
'order': 34
},
'matele': {
'resolver': '/resources/lib/channels/fr/via:get_live_url',
'resolver': '/resources/lib/channels/fr/via_matele:get_live_url',
'label': 'viàMaTélé',
'thumb': 'channels/fr/viamatele.png',
'fanart': 'channels/fr/viamatele_fanart.jpg',
Expand Down

0 comments on commit 7129309

Please sign in to comment.