How to use the spotdl.youtube_tools.set_api_key function in spotdl

To help you get started, we’ve selected a few spotdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_custom(self):
        const.args.youtube_api_key = EXPECTED_YT_API_KEY_CUSTOM
        youtube_tools.set_api_key()
        key = youtube_tools.pafy.g.api_key
        assert key == EXPECTED_YT_API_KEY_CUSTOM
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_download_from_list_without_youtube_api(
        self, metadata_fixture, content_fixture
    ):
        const.args.youtube_api_key = None
        youtube_tools.set_api_key()
        content_fixture = youtube_tools.go_pafy(TRACK_SEARCH, metadata_fixture)
        title = youtube_tools.get_youtube_title(content_fixture, 1)
        assert title == "1. {0}".format(EXPECTED_TITLE)
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_single_download_with_youtube_api(self, title_fixture):
        const.args.youtube_api_key = YT_API_KEY
        youtube_tools.set_api_key()
        assert title_fixture == EXPECTED_TITLE
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_default(self):
        const.args.youtube_api_key = None
        youtube_tools.set_api_key()
        key = youtube_tools.pafy.g.api_key
        assert key == EXPECTED_YT_API_KEY
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_single_download_with_youtube_api(self, title_fixture):
        const.args.youtube_api_key = YT_API_KEY
        youtube_tools.set_api_key()
        assert title_fixture == EXPECTED_TITLE
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_custom(self):
        const.args.youtube_api_key = EXPECTED_YT_API_KEY_CUSTOM
        youtube_tools.set_api_key()
        key = youtube_tools.pafy.g.api_key
        assert key == EXPECTED_YT_API_KEY_CUSTOM
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_download_from_list_without_youtube_api(
        self, metadata_fixture, content_fixture
    ):
        const.args.youtube_api_key = None
        youtube_tools.set_api_key()
        content_fixture = youtube_tools.go_pafy(TRACK_SEARCH, metadata_fixture)
        title = youtube_tools.get_youtube_title(content_fixture, 1)
        assert title == "1. {0}".format(EXPECTED_TITLE)
github ritiek / spotify-downloader / spotdl / spotdl.py View on Github external
def main():
    const.args = handle.get_arguments()

    internals.filter_path(const.args.folder)
    youtube_tools.set_api_key()
    spotify = spotify_tools.SpotifyAuthorize()

    logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level)

    try:
        match_args()
        # actually we don't necessarily need this, but yeah...
        # explicit is better than implicit!
        sys.exit(0)

    except KeyboardInterrupt as e:
        log.exception(e)
        sys.exit(3)
github ritiek / spotify-downloader / spotdl / spotdl.py View on Github external
def main():
    const.args = handle.get_arguments()

    internals.filter_path(const.args.folder)
    youtube_tools.set_api_key()

    logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level)

    try:
        match_args()
        # actually we don't necessarily need this, but yeah...
        # explicit is better than implicit!
        sys.exit(0)

    except KeyboardInterrupt as e:
        log.exception(e)
        sys.exit(3)