mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-24 04:10:12 +09:00
Merge c848132084
into c5098961b0
This commit is contained in:
commit
2664c93d3e
@ -1,6 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_str
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@ -12,7 +14,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class RumbleEmbedIE(InfoExtractor):
|
class RumbleEmbedIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?rumble\.com/embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)'
|
_VALID_URL = r'https?://(?:www\.)?rumble\.com/(?:embed/(?:[0-9a-z]+\.)?(?P<id>[0-9a-z]+)|([0-9a-z]+)-(.*?)\.html)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://rumble.com/embed/v5pv5f',
|
'url': 'https://rumble.com/embed/v5pv5f',
|
||||||
'md5': '36a18a049856720189f30977ccbb2c34',
|
'md5': '36a18a049856720189f30977ccbb2c34',
|
||||||
@ -26,10 +28,18 @@ class RumbleEmbedIE(InfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'https://rumble.com/embed/ufe9n.v5pv5f',
|
'url': 'https://rumble.com/embed/ufe9n.v5pv5f',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://rumble.com/vhlrar-mike-lindell-to-confront-brian-kemp-and-doug-ducey-over-election-fraud.html',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
if re.match(r'https?://(?:www\.)?rumble\.com/([0-9a-z]+)-(.*?)\.html', url):
|
||||||
|
direct_video_id = re.findall(r'https?://(?:www\.)?rumble\.com/([0-9a-z]+)-(?:.*?)\.html', url)[0]
|
||||||
|
content = self._download_webpage(url, direct_video_id)
|
||||||
|
video_id = re.findall(r'"embedUrl"\s*:\s*"https://rumble\.com/embed/(.*?)/"', content)[0]
|
||||||
|
else:
|
||||||
|
video_id = self._match_id(url)
|
||||||
video = self._download_json(
|
video = self._download_json(
|
||||||
'https://rumble.com/embedJS/', video_id,
|
'https://rumble.com/embedJS/', video_id,
|
||||||
query={'request': 'video', 'v': video_id})
|
query={'request': 'video', 'v': video_id})
|
||||||
|
Loading…
Reference in New Issue
Block a user