|
|
|
@ -31,6 +31,11 @@ from ..generic import (
|
|
|
|
from .base import MediaExtractor
|
|
|
|
from .base import MediaExtractor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YTDLP_OPTS = {
|
|
|
|
|
|
|
|
"check_formats": False,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeMediaExtractor(MediaExtractor[YoutubeVideoData]):
|
|
|
|
class YoutubeMediaExtractor(MediaExtractor[YoutubeVideoData]):
|
|
|
|
__uri_regex = re.compile(
|
|
|
|
__uri_regex = re.compile(
|
|
|
|
r"""^
|
|
|
|
r"""^
|
|
|
|
@ -78,7 +83,7 @@ class YoutubeMediaExtractor(MediaExtractor[YoutubeVideoData]):
|
|
|
|
raise Exception(f"URI not suitable: {uri!r}")
|
|
|
|
raise Exception(f"URI not suitable: {uri!r}")
|
|
|
|
id = uri_match.group("id")
|
|
|
|
id = uri_match.group("id")
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
with YoutubeDL({}) as ydl:
|
|
|
|
with YoutubeDL(YTDLP_OPTS) as ydl:
|
|
|
|
info = ydl.extract_info(
|
|
|
|
info = ydl.extract_info(
|
|
|
|
f"https://www.youtube.com/watch?v={id}",
|
|
|
|
f"https://www.youtube.com/watch?v={id}",
|
|
|
|
download=False,
|
|
|
|
download=False,
|
|
|
|
|