]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/rumble.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
16 class RumbleEmbedIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
19 'url': 'https://rumble.com/embed/v5pv5f',
20 'md5': '36a18a049856720189f30977ccbb2c34',
24 'title': 'WMAR 2 News Latest Headlines | October 20, 6pm',
25 'timestamp': 1571611968,
26 'upload_date': '20191020',
29 'url': 'https://rumble.com/embed/ufe9n.v5pv5f',
30 'only_matching': True,
34 def _extract_urls(webpage
):
37 for mobj
in re
.finditer(
38 r
'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl
["\']\s*:\s*)["\'](?P
<url
>%s)' % RumbleEmbedIE._VALID_URL,
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
43 video = self._download_json(
44 'https
://rumble
.com
/embedJS
/', video_id,
45 query={'request': 'video', 'v': video_id})
46 title = video['title
']
49 for height, ua in (video.get('ua
') or {}).items():
51 f_url = try_get(ua, lambda x: x[i], compat_str)
53 ext = determine_ext(f_url)
56 'format_id
': '%s-%sp
' % (ext, height),
57 'height
': int_or_none(height),
60 bitrate = try_get(ua, lambda x: x[i + 2]['bitrate
'])
62 f['tbr
'] = int_or_none(bitrate)
64 self._sort_formats(formats)
66 author = video.get('author
') or {}
72 'thumbnail
': video.get('i
'),
73 'timestamp
': parse_iso8601(video.get('pubDate
')),
74 'channel
': author.get('name
'),
75 'channel_url
': author.get('url
'),
76 'duration
': int_or_none(video.get('duration
')),