feat: made youtube optional

This commit is contained in:
Hazel 2023-09-12 11:16:25 +02:00
parent d98f72f836
commit 263b1f203b
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from typing import Tuple, Type, Dict, Set
from .results import SearchResults
from ..objects import DatabaseObject, Source
from ..utils.config import youtube_settings
from ..utils.enums.source import SourcePages
from ..utils.support_classes import Query, DownloadResult
from ..utils.exception.download import UrlNotFoundException
@ -21,10 +22,12 @@ if DEBUG_PAGES:
ALL_PAGES: Set[Type[Page]] = {
EncyclopaediaMetallum,
Musify,
# YouTube,
YoutubeMusic
}
if youtube_settings["use_youtube_alongside_youtube_music"]:
ALL_PAGES.add(YouTube)
AUDIO_PAGES: Set[Type[Page]] = {
Musify,
YouTube,

View File

@ -10,6 +10,9 @@ from ..attributes.special_attributes import SelectAttribute, PathAttribute, UrlA
config = Config([
Attribute(name="use_youtube_alongside_youtube_music", default_value=False, description="""If set to true, it will search youtube through invidious and piped,
despite a direct wrapper for the youtube music INNERTUBE api being implemented.
I my INNERTUBE api wrapper doesn't work, set this to true."""),
UrlAttribute(name="invidious_instance", default_value="https://yt.artemislena.eu", description="""This is an attribute, where you can define the invidious instances,
the youtube downloader should use.
Here is a list of active ones: https://docs.invidious.io/instances/
@ -91,7 +94,7 @@ If any instance seems to be missing, run music kraken with the -f flag."""),
class SettingsStructure(TypedDict):
# youtube
use_youtube_alongside_youtube_music: bool
invidious_instance: ParseResult
piped_instance: ParseResult
sleep_after_youtube_403: float