mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-06 21:38:31 +00:00
Create speedrun.py
This commit is contained in:
parent
2ee3a0aff9
commit
a5016aff9c
24
yt_dlp/extractor/speedrun.py
Normal file
24
yt_dlp/extractor/speedrun.py
Normal file
@ -0,0 +1,24 @@
|
||||
from .common import InfoExtractor
|
||||
|
||||
# Speedrun.com has the ability to host twitch embeds as well which is why this script was needed.
|
||||
|
||||
class SpeedRunIE(InfoExtractor):
|
||||
IE_NAME = "speedrun"
|
||||
_VALID_URL = r'https?://(?:www\.)?speedrun\.com/[^/?#]+/runs/(?P<id>[^?/#]+)'
|
||||
|
||||
_TESTS = [{
|
||||
"url":"https://www.speedrun.com/smg1/runs/yvnjr9om",
|
||||
'only_matching': True
|
||||
}, {
|
||||
"url":"https://www.speedrun.com/pm64/runs/y96x462y",
|
||||
'only_matching': True
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
embed_url = self._search_regex(
|
||||
r'<iframe [^>]*class="[^"]*block[^"]+" [^>]*src="([^"]+)', webpage, 'embed url')
|
||||
|
||||
return self.url_result(embed_url)
|
||||
|
Loading…
Reference in New Issue
Block a user