]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/gab.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class GabTVIE(InfoExtractor
):
14 _VALID_URL
= r
'(?:https?://)tv.gab.com/channel/[^/]+/view/(?P<id>[a-z0-9-]+)'
16 'url': 'https://tv.gab.com/channel/wurzelroot/view/why-was-america-in-afghanistan-61217eacea5665de450d0488',
18 'id': '61217eacea5665de450d0488',
20 'title': 'WHY WAS AMERICA IN AFGHANISTAN - AMERICA FIRST AGAINST AMERICAN OLIGARCHY',
22 'uploader': 'Wurzelroot',
23 'uploader_id': '608fb0a85738fd1974984f7d',
24 'thumbnail': 'https://tv.gab.com/image/61217eacea5665de450d0488',
28 def _real_extract(self
, url
):
29 id = self
._match
_id
(url
).split('-')[-1]
30 webpage
= self
._download
_webpage
(url
, id)
31 channel_id
= self
._search
_regex
(r
'data-channel-id=\"(?P<channel_id>[^\"]+)', webpage
, 'channel_id')
32 channel_name
= self
._search
_regex
(r
'data-channel-name=\"(?P<channel_id>[^\"]+)', webpage
, 'channel_name')
33 title
= self
._search
_regex
(r
'data-episode-title=\"(?P<channel_id>[^\"]+)', webpage
, 'title')
34 view_key
= self
._search
_regex
(r
'data-view-key=\"(?P<channel_id>[^\"]+)', webpage
, 'view_key')
35 description
= clean_html(self
._html
_search
_regex
(self
._meta
_regex
('description'), webpage
, 'description', group
='content')) or None
36 available_resolutions
= re
.findall(r
'<a\ data-episode-id=\"%s\"\ data-resolution=\"(?P<resolution>[^\"]+)' % id, webpage
)
39 for resolution
in available_resolutions
:
41 'url': f
'https://tv.gab.com/media/{id}?viewKey={view_key}&r={resolution}',
42 'format_id': resolution
,
47 if 'audio-' in resolution
:
48 frmt
['abr'] = str_to_int(resolution
.replace('audio-', ''))
52 frmt
['height'] = str_to_int(resolution
.replace('p', ''))
54 self
._sort
_formats
(formats
)
60 'description': description
,
61 'uploader': channel_name
,
62 'uploader_id': channel_id
,
63 'thumbnail': f
'https://tv.gab.com/image/{id}',