download strats
This commit is contained in:
parent
4bdbb27b63
commit
52a9a8db86
3 changed files with 32 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
|
|
||||||
|
|
@ -32,6 +33,15 @@ class SoundcloudAlbumsAndSinglesDownloadOptions(DownloaderValidator):
|
||||||
_required_keys = {"url"}
|
_required_keys = {"url"}
|
||||||
_optional_keys = {"skip_premiere_tracks"}
|
_optional_keys = {"skip_premiere_tracks"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def partial_validate(cls, name: str, value: Any) -> None:
|
||||||
|
"""
|
||||||
|
Partially validate a Soundcloud source
|
||||||
|
"""
|
||||||
|
if isinstance(value, dict):
|
||||||
|
value["url"] = value.get("url", "https://soundcloud.com/jessebannon")
|
||||||
|
_ = cls(name, value)
|
||||||
|
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
super().__init__(name, value)
|
super().__init__(name, value)
|
||||||
self._url = self._validate_key(
|
self._url = self._validate_key(
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
@ -31,6 +32,17 @@ class YoutubePlaylistDownloaderOptions(DownloaderValidator):
|
||||||
_required_keys = {"playlist_url"}
|
_required_keys = {"playlist_url"}
|
||||||
_optional_keys = {"playlist_thumbnail_name"}
|
_optional_keys = {"playlist_thumbnail_name"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def partial_validate(cls, name: str, value: Any) -> None:
|
||||||
|
"""
|
||||||
|
Partially validate a YouTube playlist source
|
||||||
|
"""
|
||||||
|
if isinstance(value, dict):
|
||||||
|
value["playlist_url"] = value.get(
|
||||||
|
"playlist_url", "https://www.youtube.com/playlist?list=UCsvn_Po0SmunchJYtttWpOxMg"
|
||||||
|
)
|
||||||
|
_ = cls(name, value)
|
||||||
|
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
super().__init__(name, value)
|
super().__init__(name, value)
|
||||||
self._playlist_url = self._validate_key(
|
self._playlist_url = self._validate_key(
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from ytdl_sub.downloaders.downloader import Downloader
|
from ytdl_sub.downloaders.downloader import Downloader
|
||||||
|
|
@ -32,6 +33,15 @@ class YoutubeVideoDownloaderOptions(DownloaderValidator):
|
||||||
|
|
||||||
_required_keys = {"video_url"}
|
_required_keys = {"video_url"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def partial_validate(cls, name: str, value: Any) -> None:
|
||||||
|
"""
|
||||||
|
Partially validate a YouTube video source
|
||||||
|
"""
|
||||||
|
if isinstance(value, dict):
|
||||||
|
value["video_url"] = value.get("video_url", "youtube.com/watch?v=VMAPTo7RVDo")
|
||||||
|
_ = cls(name, value)
|
||||||
|
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
super().__init__(name, value)
|
super().__init__(name, value)
|
||||||
self._video_url = self._validate_key("video_url", YoutubeVideoUrlValidator).video_url
|
self._video_url = self._validate_key("video_url", YoutubeVideoUrlValidator).video_url
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue