]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/rumble.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
8 from ..compat
import compat_str
, compat_HTTPError
18 class RumbleEmbedIE(InfoExtractor
):
19 _VALID_URL
= r
'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
21 'url': 'https://rumble.com/embed/v5pv5f',
22 'md5': '36a18a049856720189f30977ccbb2c34',
26 'title': 'WMAR 2 News Latest Headlines | October 20, 6pm',
27 'timestamp': 1571611968,
28 'upload_date': '20191020',
31 'url': 'https://rumble.com/embed/ufe9n.v5pv5f',
32 'only_matching': True,
36 def _extract_urls(webpage
):
39 for mobj
in re
.finditer(
40 r
'(?:<(?:script|iframe)[^>]+\bsrc=|["\']embedUrl
["\']\s*:\s*)["\'](?P
<url
>%s)' % RumbleEmbedIE._VALID_URL,
43 def _real_extract(self, url):
44 video_id = self._match_id(url)
45 video = self._download_json(
46 'https
://rumble
.com
/embedJS
/', video_id,
47 query={'request': 'video', 'v': video_id})
48 title = video['title
']
51 for height, ua in (video.get('ua
') or {}).items():
53 f_url = try_get(ua, lambda x: x[i], compat_str)
55 ext = determine_ext(f_url)
58 'format_id
': '%s-%sp
' % (ext, height),
59 'height
': int_or_none(height),
62 bitrate = try_get(ua, lambda x: x[i + 2]['bitrate
'])
64 f['tbr
'] = int_or_none(bitrate)
66 self._sort_formats(formats)
68 author = video.get('author
') or {}
74 'thumbnail
': video.get('i
'),
75 'timestamp
': parse_iso8601(video.get('pubDate
')),
76 'channel
': author.get('name
'),
77 'channel_url
': author.get('url
'),
78 'duration
': int_or_none(video.get('duration
')),
82 class RumbleChannelIE(InfoExtractor):
83 _VALID_URL = r'(?P
<url
>https?
://(?
:www\
.)?rumble\
.com
/(?
:c|user
)/(?P
<id>[^
&?
#$/]+))'
86 'url': 'https://rumble.com/c/Styxhexenhammer666',
87 'playlist_mincount': 1160,
89 'id': 'Styxhexenhammer666',
92 'url': 'https://rumble.com/user/goldenpoodleharleyeuna',
95 'id': 'goldenpoodleharleyeuna',
99 def entries(self
, url
, playlist_id
):
100 for page
in itertools
.count(1):
102 webpage
= self
._download
_webpage
(f
'{url}?page={page}', playlist_id
, note
='Downloading page %d' % page
)
103 except ExtractorError
as e
:
104 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 404:
107 for video_url
in re
.findall(r
'class=video-item--a\s?href=([^>]+\.html)', webpage
):
108 yield self
.url_result('https://rumble.com' + video_url
)
110 def _real_extract(self
, url
):
111 url
, playlist_id
= self
._match
_valid
_url
(url
).groups()
112 return self
.playlist_result(self
.entries(url
, playlist_id
), playlist_id
=playlist_id
)