Apply suggestions

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
pull/14015/head
doe1080 1 day ago committed by GitHub
parent 4c0a55ac8e
commit 2d05bcee97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -90,7 +90,7 @@ class MedialaanIE(MedialaanBaseIE):
tubantia| tubantia|
volkskrant volkskrant
)\.nl )\.nl
)/videos?/(?:[^/]+/)*[^/?&#]+(?:-|~p) )/videos?/(?:[^/?#]+/)*[^/?&#]+(?:-|~p)
) )
(?P<id>\d+) (?P<id>\d+)
''' '''
@ -213,11 +213,10 @@ class MedialaanIE(MedialaanBaseIE):
@classmethod @classmethod
def _extract_embed_urls(cls, url, webpage): def _extract_embed_urls(cls, url, webpage):
return traverse_obj(webpage, ( yield from traverse_obj(webpage, (
{find_elements(tag='div', attr='data-mychannels-type', value='video', html=True)}, {find_elements(tag='div', attr='data-mychannels-type', value='video', html=True)},
..., {extract_attributes}, 'data-mychannels-id', {str}, ..., {extract_attributes}, 'data-mychannels-id', {str}, filter,
{lambda x: f'https://mychannels.video/embed/{x}'}, {url_or_none}, filter, all, filter, {lambda x: f'https://mychannels.video/embed/{x}'}))
))
def _real_extract(self, url): def _real_extract(self, url):
mychannels_id = self._match_id(url) mychannels_id = self._match_id(url)

@ -4,7 +4,7 @@ from ..utils.traversal import require, traverse_obj
class VTMIE(MedialaanBaseIE): class VTMIE(MedialaanBaseIE):
_VALID_URL = r'https?://(?:www\.)?vtm\.be/[^/?#]+~v(?P<id>[\da-f-]+)' _VALID_URL = r'https?://(?:www\.)?vtm\.be/[^/?#]+~v(?P<id>[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})'
_TESTS = [{ _TESTS = [{
'url': 'https://vtm.be/gast-vernielt-genkse-hotelkamer~ve7534523-279f-4b4d-a5c9-a33ffdbe23e1', 'url': 'https://vtm.be/gast-vernielt-genkse-hotelkamer~ve7534523-279f-4b4d-a5c9-a33ffdbe23e1',
'info_dict': { 'info_dict': {
@ -32,11 +32,11 @@ class VTMIE(MedialaanBaseIE):
self.raise_login_required() self.raise_login_required()
def _real_extract(self, url): def _real_extract(self, url):
uuid = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, uuid) webpage = self._download_webpage(url, video_id)
apollo_state = self._search_json( apollo_state = self._search_json(
r'window\.__APOLLO_STATE__\s*=', webpage, 'apollo state', uuid) r'window\.__APOLLO_STATE__\s*=', webpage, 'apollo state', video_id)
mychannels_id = traverse_obj(apollo_state, ( mychannels_id = traverse_obj(apollo_state, (
f'Video:{{"uuid":"{uuid}"}}', 'myChannelsVideo', {str_or_none}, {require('mychannels ID')})) f'Video:{{"uuid":"{video_id}"}}', 'myChannelsVideo', {str_or_none}, {require('mychannels ID')}))
return self._extract_from_mychannels_api(mychannels_id) return self._extract_from_mychannels_api(mychannels_id)

Loading…
Cancel
Save