From 263b1f203bb94bf6e562bc24f24791ac3ea4c59b Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 12 Sep 2023 11:16:25 +0200 Subject: [PATCH] feat: made youtube optional --- src/music_kraken/download/page_attributes.py | 5 ++++- src/music_kraken/utils/config/config_files/youtube_config.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/music_kraken/download/page_attributes.py b/src/music_kraken/download/page_attributes.py index c7456bc..4ab45d0 100644 --- a/src/music_kraken/download/page_attributes.py +++ b/src/music_kraken/download/page_attributes.py @@ -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, diff --git a/src/music_kraken/utils/config/config_files/youtube_config.py b/src/music_kraken/utils/config/config_files/youtube_config.py index 8b0d102..8870a54 100644 --- a/src/music_kraken/utils/config/config_files/youtube_config.py +++ b/src/music_kraken/utils/config/config_files/youtube_config.py @@ -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