__init__
Init module for spotdl. This module contains the main entry point for spotdl. And Spotdl class
Spotdl(client_id, client_secret, user_auth=False, cache_path=None, no_cache=False, headless=False, downloader_settings=None, loop=None)
¤
Spotdl class, which simplifies the process of downloading songs from Spotify.
from spotdl import Spotdl
spotdl = Spotdl(client_id='your-client-id', client_secret='your-client-secret')
songs = spotdl.search(['joji - test drive',
'https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT'])
results = spotdl.download_songs(songs)
song, path = spotdl.download(songs[0])
Arguments¤
- client_id: Spotify client id
- client_secret: Spotify client secret
- user_auth: If true, user will be prompted to authenticate
- cache_path: Path to cache directory
- no_cache: If true, no cache will be used
- headless: If true, no browser will be opened
- downloader_settings: Settings for the downloader
- loop: Event loop to use
Source code in spotdl/__init__.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
download(song)
¤
Download and convert song to the output format.
Arguments¤
- song: Song object
Returns¤
- A tuple containing the song and the path to the downloaded file if successful.
Source code in spotdl/__init__.py
144 145 146 147 148 149 150 151 152 153 154 155 |
|
download_songs(songs)
¤
Download and convert songs to the output format.
Arguments¤
- songs: List of Song objects
Returns¤
- A list of tuples containing the song and the path to the downloaded file if successful.
Source code in spotdl/__init__.py
157 158 159 160 161 162 163 164 165 166 167 168 |
|
get_download_urls(songs)
¤
Get the download urls for a list of songs.
Arguments¤
- songs: List of Song objects
Returns¤
- A list of urls if successful.
Notes¤
- This function is multi-threaded.
Source code in spotdl/__init__.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
search(query)
¤
Search for songs.
Arguments¤
- query: List of search queries
Returns¤
- A list of Song objects
Notes¤
- query can be a list of song titles, urls, uris
Source code in spotdl/__init__.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
console_entry_point()
¤
Entry point for the console. With profile flag, it runs the code with cProfile.
Source code in spotdl/console/entry_point.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|