| 1 |
FAQ |
| 2 |
===== |
| 3 |
|
| 4 |
Frequently asked questions for ``ytmusicapi``. Contributions are welcome, please |
| 5 |
`submit a PR <https://github.com/sigma67/ytmusicapi/pulls>`_. |
| 6 |
|
| 7 |
Setup |
| 8 |
------------ |
| 9 |
|
| 10 |
My library results are empty even though I set up my cookie correctly. |
| 11 |
*********************************************************************** |
| 12 |
Please make sure that you don't have multiple Google accounts. ``ytmusicapi`` might be returning |
| 13 |
results from a different account which is currently empty. You can set your account using ``X-Goog-AuthUser`` |
| 14 |
in your headers file (numeric index) or by providing the id of a brand account with ``ytmusic = YTMusic(headers, "1234..")``. |
| 15 |
For more details see the :doc:`reference/index`. |
| 16 |
|
| 17 |
Usage |
| 18 |
----------------------- |
| 19 |
|
| 20 |
How do I add content to my library? |
| 21 |
*********************************************************************** |
| 22 |
- **songs**: `edit_song_library_status <reference.html#ytmusicapi.YTMusic.edit_song_library_status>`__ . |
| 23 |
Liking a song using `rate_song <reference.html#ytmusicapi.YTMusic.rate_song>`__ |
| 24 |
does *not* add it to your library, only to your liked songs playlist. |
| 25 |
- **albums, playlists**: `rate_playlist <reference.html#ytmusicapi.YTMusic.rate_playlist>`__ |
| 26 |
- **artists**: `subscribe_artists <reference.html#ytmusicapi.YTMusic.subscribe_artists>`__ . |
| 27 |
This will add the artist to your Subscriptions tab. The Artists tab is determined by the songs/albums you have |
| 28 |
added to your library. |
| 29 |
- **podcasts**: `rate_playlist <reference.html#ytmusicapi.YTMusic.rate_playlist>`__ |
| 30 |
- **episodes**: `add_playlist_items("SE", episode_id) <reference.html#ytmusicapi.YTMusic.add_playlist_items>`__ |
| 31 |
|
| 32 |
What are the different feedback tokens? |
| 33 |
******************************************************* |
| 34 |
|
| 35 |
Pass these attributes to `edit_song_library_status <reference/library.html#ytmusicapi.YTMusic.edit_song_library_status>`__ to |
| 36 |
perform library management: |
| 37 |
|
| 38 |
- ``feedbackTokens``: ``add``/``remove`` from library (refer to ``inLibrary`` for the current status) |
| 39 |
- ``listenAgainFeedbackTokens``: ``pin``/``unpin`` from the "Listen Again" carousel (refer to ``pinnedToListenAgain`` for the current status) |
| 40 |
|
| 41 |
`get_history <reference/library.html#ytmusicapi.YTMusic.get_history>`__ items include ``feedbackToken``, which can be passed to |
| 42 |
`remove_history_items <reference/library.html#ytmusicapi.YTMusic.remove_history_items>`__. |
| 43 |
|
| 44 |
How can I get the radio playlist for a song, video, playlist or album? |
| 45 |
*********************************************************************** |
| 46 |
- **songs, videos**: ``RDAMVM`` + ``videoId`` |
| 47 |
- **playlists, albums**: ``RDAMPL`` + ``playlistId`` |
| 48 |
|
| 49 |
See also `What is a browseId <faq.html#what-is-a-browseid>`__ below. |
| 50 |
|
| 51 |
|
| 52 |
How can I get the shuffle playlist for a playlist or album? |
| 53 |
*********************************************************************** |
| 54 |
Use `get_watch_playlist_shuffle <reference.html#ytmusicapi.YTMusic.get_watch_playlist_shuffle>`__ |
| 55 |
with the ``playlistId`` or ``audioPlaylistId`` (albums). |
| 56 |
|
| 57 |
How can I get all my public playlists in a single request? |
| 58 |
*********************************************************************** |
| 59 |
Call `get_user_playlists <reference.html#ytmusicapi.YTMusic.get_user_playlists>`__ |
| 60 |
with your own ``channelId``. |
| 61 |
|
| 62 |
Can I download songs? |
| 63 |
*********************************************************************** |
| 64 |
You can use `youtube-dl <https://github.com/ytdl-org/youtube-dl/>`_ for this purpose. |
| 65 |
|
| 66 |
How do I package ytmusicapi with ``pyinstaller``? |
| 67 |
************************************************* |
| 68 |
|
| 69 |
To package ytmusicapi correctly, you need to add the locales files to your executable. |
| 70 |
|
| 71 |
You can use ``--add-data path-to-ytmusicapi/locales`` or ``--collect-all ytmusicapi`` to accomplish this. |
| 72 |
|
| 73 |
|
| 74 |
YouTube Music API Internals |
| 75 |
------------------------------ |
| 76 |
|
| 77 |
Is there a difference between songs and videos? |
| 78 |
*********************************************************************** |
| 79 |
Yes. Videos are regular videos from YouTube, which can be uploaded by any user. Songs are actual songs uploaded by artists. |
| 80 |
|
| 81 |
You can also add songs to your library, while you can't add videos. |
| 82 |
|
| 83 |
Is there a rate limit? |
| 84 |
*********************************************************************** |
| 85 |
There most certainly is, although you shouldn't run into it during normal usage. |
| 86 |
See related issues: |
| 87 |
|
| 88 |
- `Creating playlists <https://github.com/sigma67/ytmusicapi/issues/19>`_ |
| 89 |
- `Uploads <https://github.com/sigma67/ytmusicapi/issues/6>`_ |
| 90 |
|
| 91 |
|
| 92 |
What is a browseId? |
| 93 |
*********************************************************************** |
| 94 |
A ``browseId`` is an internal, globally unique identifier used by YouTube Music for browsable content. |
| 95 |
|
| 96 |
In most cases you can compose it yourself: |
| 97 |
|
| 98 |
+--------+------------+----------------------+ |
| 99 |
| Prefix | Main | Content | |
| 100 |
+========+============+======================+ |
| 101 |
| VM | playlistId | Playlist | |
| 102 |
+--------+------------+----------------------+ |
| 103 |
| RDAMVM | playlistId | Video-based Radio | |
| 104 |
+--------+------------+----------------------+ |
| 105 |
| RDAMPL | videoId | Playlist-based Radio | |
| 106 |
+--------+------------+----------------------+ |
| 107 |
| MPLA | channelId | Artist | |
| 108 |
+--------+------------+----------------------+ |
| 109 |
| MPRE | custom | Album | |
| 110 |
+--------+------------+----------------------+ |
| 111 |
| MPSP | playlistId | Podcast | |
| 112 |
+--------+------------+----------------------+ |
| 113 |
| MPED | videoId | Episode | |
| 114 |
+--------+------------+----------------------+ |
| 115 |
|
| 116 |
|
| 117 |
Which videoTypes exist and what do they mean? |
| 118 |
*********************************************************************** |
| 119 |
|
| 120 |
``videoType`` is prefixed with ``MUSIC_VIDEO_TYPE_``, i.e. ``MUSIC_VIDEO_TYPE_OMV``. |
| 121 |
Currently the following variants of ``videoType`` are known: |
| 122 |
|
| 123 |
- ``OMV``: Original Music Video - uploaded by original artist with actual video content |
| 124 |
- ``UGC``: User Generated Content - uploaded by regular YouTube user |
| 125 |
- ``ATV``: High quality song uploaded by original artist with cover image |
| 126 |
- ``OFFICIAL_SOURCE_MUSIC``: Official video content, but not for a single track |
| 127 |
|
| 128 |
|
| 129 |
Why is ytmusicapi returning more results than requested with the limit parameter? |
| 130 |
********************************************************************************* |
| 131 |
YouTube Music always returns increments of a specific pagination value, usually between 20 and 100 items at a time. |
| 132 |
This is the case if a ytmusicapi method supports the ``limit`` parameter. The default value of the ``limit`` parameter |
| 133 |
indicates the server-side pagination increment. ytmusicapi will keep fetching continuations from the server until it has |
| 134 |
reached at least the ``limit`` parameter, and return all of these results. |
| 135 |
|
| 136 |
|
| 137 |
Which values can I use for languages? |
| 138 |
************************************* |
| 139 |
|
| 140 |
The ``language`` parameter determines the language of the returned results. |
| 141 |
``ytmusicapi`` only supports a subset of the languages supported by YouTube Music, as translations need to be done manually. |
| 142 |
Contributions are welcome, see `here for instructions <https://github.com/sigma67/ytmusicapi/tree/master/ytmusicapi/locales>`__. |
| 143 |
|
| 144 |
For the list of values you can use for the ``language`` parameter, see below: |
| 145 |
|
| 146 |
.. raw:: html |
| 147 |
|
| 148 |
<details> |
| 149 |
<br> |
| 150 |
<summary><a>Supported locations</a></summary> |
| 151 |
|
| 152 |
.. container:: |
| 153 |
|
| 154 |
.. list-table:: |
| 155 |
|
| 156 |
* - **Language** |
| 157 |
- **Value** |
| 158 |
* - Arabic |
| 159 |
- ar |
| 160 |
* - German |
| 161 |
- de |
| 162 |
* - English (default) |
| 163 |
- en |
| 164 |
* - Spanish |
| 165 |
- es |
| 166 |
* - French |
| 167 |
- fr |
| 168 |
* - Hindi |
| 169 |
- hi |
| 170 |
* - Italian |
| 171 |
- it |
| 172 |
* - Japanese |
| 173 |
- ja |
| 174 |
* - Korean |
| 175 |
- ko |
| 176 |
* - Dutch |
| 177 |
- nl |
| 178 |
* - Portuguese |
| 179 |
- pt |
| 180 |
* - Russian |
| 181 |
- ru |
| 182 |
* - Turkish |
| 183 |
- tr |
| 184 |
* - Urdu |
| 185 |
- ur |
| 186 |
* - Chinese (Mainland) |
| 187 |
- zh_CN |
| 188 |
* - Chinese (Taiwan) |
| 189 |
- zh_TW |
| 190 |
|
| 191 |
|
| 192 |
.. raw:: html |
| 193 |
|
| 194 |
</details> |
| 195 |
</br> |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
Which values can I use for locations? |
| 200 |
************************************* |
| 201 |
|
| 202 |
Pick a value from the list below for your desired location and pass it using the ``location`` parameter. |
| 203 |
|
| 204 |
.. raw:: html |
| 205 |
|
| 206 |
<details> |
| 207 |
<br> |
| 208 |
<summary><a>Supported locations</a></summary> |
| 209 |
|
| 210 |
.. container:: |
| 211 |
|
| 212 |
.. list-table:: |
| 213 |
|
| 214 |
* - **Location** |
| 215 |
- **Value** |
| 216 |
* - Algeria |
| 217 |
- DZ |
| 218 |
* - Argentina |
| 219 |
- AR |
| 220 |
* - Australia |
| 221 |
- AU |
| 222 |
* - Austria |
| 223 |
- AT |
| 224 |
* - Azerbaijan |
| 225 |
- AZ |
| 226 |
* - Bahrain |
| 227 |
- BH |
| 228 |
* - Bangladesh |
| 229 |
- BD |
| 230 |
* - Belarus |
| 231 |
- BY |
| 232 |
* - Belgium |
| 233 |
- BE |
| 234 |
* - Bolivia |
| 235 |
- BO |
| 236 |
* - Bosnia and Herzegovina |
| 237 |
- BA |
| 238 |
* - Brazil |
| 239 |
- BR |
| 240 |
* - Bulgaria |
| 241 |
- BG |
| 242 |
* - Cambodia |
| 243 |
- KH |
| 244 |
* - Canada |
| 245 |
- CA |
| 246 |
* - Chile |
| 247 |
- CL |
| 248 |
* - Colombia |
| 249 |
- CO |
| 250 |
* - Costa Rica |
| 251 |
- CR |
| 252 |
* - Croatia |
| 253 |
- HR |
| 254 |
* - Cyprus |
| 255 |
- CY |
| 256 |
* - Czechia |
| 257 |
- CZ |
| 258 |
* - Denmark |
| 259 |
- DK |
| 260 |
* - Dominican Republic |
| 261 |
- DO |
| 262 |
* - Ecuador |
| 263 |
- EC |
| 264 |
* - Egypt |
| 265 |
- EG |
| 266 |
* - El Salvador |
| 267 |
- SV |
| 268 |
* - Estonia |
| 269 |
- EE |
| 270 |
* - Finland |
| 271 |
- FI |
| 272 |
* - France |
| 273 |
- FR |
| 274 |
* - Georgia |
| 275 |
- GE |
| 276 |
* - Germany |
| 277 |
- DE |
| 278 |
* - Ghana |
| 279 |
- GH |
| 280 |
* - Greece |
| 281 |
- GR |
| 282 |
* - Guatemala |
| 283 |
- GT |
| 284 |
* - Honduras |
| 285 |
- HN |
| 286 |
* - Hong Kong |
| 287 |
- HK |
| 288 |
* - Hungary |
| 289 |
- HU |
| 290 |
* - Iceland |
| 291 |
- IS |
| 292 |
* - India |
| 293 |
- IN |
| 294 |
* - Indonesia |
| 295 |
- ID |
| 296 |
* - Iraq |
| 297 |
- IQ |
| 298 |
* - Ireland |
| 299 |
- IE |
| 300 |
* - Israel |
| 301 |
- IL |
| 302 |
* - Italy |
| 303 |
- IT |
| 304 |
* - Jamaica |
| 305 |
- JM |
| 306 |
* - Japan |
| 307 |
- JP |
| 308 |
* - Jordan |
| 309 |
- JO |
| 310 |
* - Kazakhstan |
| 311 |
- KZ |
| 312 |
* - Kenya |
| 313 |
- KE |
| 314 |
* - Kuwait |
| 315 |
- KW |
| 316 |
* - Laos |
| 317 |
- LA |
| 318 |
* - Latvia |
| 319 |
- LV |
| 320 |
* - Lebanon |
| 321 |
- LB |
| 322 |
* - Libya |
| 323 |
- LY |
| 324 |
* - Liechtenstein |
| 325 |
- LI |
| 326 |
* - Lithuania |
| 327 |
- LT |
| 328 |
* - Luxembourg |
| 329 |
- LU |
| 330 |
* - Malaysia |
| 331 |
- MY |
| 332 |
* - Malta |
| 333 |
- MT |
| 334 |
* - Mexico |
| 335 |
- MX |
| 336 |
* - Montenegro |
| 337 |
- ME |
| 338 |
* - Morocco |
| 339 |
- MA |
| 340 |
* - Nepal |
| 341 |
- NP |
| 342 |
* - Netherlands |
| 343 |
- NL |
| 344 |
* - New Zealand |
| 345 |
- NZ |
| 346 |
* - Nicaragua |
| 347 |
- NI |
| 348 |
* - Nigeria |
| 349 |
- NG |
| 350 |
* - North Macedonia |
| 351 |
- MK |
| 352 |
* - Norway |
| 353 |
- NO |
| 354 |
* - Oman |
| 355 |
- OM |
| 356 |
* - Pakistan |
| 357 |
- PK |
| 358 |
* - Panama |
| 359 |
- PA |
| 360 |
* - Papua New Guinea |
| 361 |
- PG |
| 362 |
* - Paraguay |
| 363 |
- PY |
| 364 |
* - Peru |
| 365 |
- PE |
| 366 |
* - Philippines |
| 367 |
- PH |
| 368 |
* - Poland |
| 369 |
- PL |
| 370 |
* - Portugal |
| 371 |
- PT |
| 372 |
* - Puerto Rico |
| 373 |
- PR |
| 374 |
* - Qatar |
| 375 |
- QA |
| 376 |
* - Romania |
| 377 |
- RO |
| 378 |
* - Russia |
| 379 |
- RU |
| 380 |
* - Saudi Arabia |
| 381 |
- SA |
| 382 |
* - Senegal |
| 383 |
- SN |
| 384 |
* - Serbia |
| 385 |
- RS |
| 386 |
* - Singapore |
| 387 |
- SG |
| 388 |
* - Slovakia |
| 389 |
- SK |
| 390 |
* - Slovenia |
| 391 |
- SI |
| 392 |
* - South Africa |
| 393 |
- ZA |
| 394 |
* - South Korea |
| 395 |
- KR |
| 396 |
* - Spain |
| 397 |
- ES |
| 398 |
* - Sri Lanka |
| 399 |
- LK |
| 400 |
* - Sweden |
| 401 |
- SE |
| 402 |
* - Switzerland |
| 403 |
- CH |
| 404 |
* - Taiwan |
| 405 |
- TW |
| 406 |
* - Tanzania |
| 407 |
- TZ |
| 408 |
* - Thailand |
| 409 |
- TH |
| 410 |
* - Tunisia |
| 411 |
- TN |
| 412 |
* - Turkey |
| 413 |
- TR |
| 414 |
* - Uganda |
| 415 |
- UG |
| 416 |
* - Ukraine |
| 417 |
- UA |
| 418 |
* - United Arab Emirates |
| 419 |
- AE |
| 420 |
* - United Kingdom |
| 421 |
- GB |
| 422 |
* - United States |
| 423 |
- US |
| 424 |
* - Uruguay |
| 425 |
- UY |
| 426 |
* - Venezuela |
| 427 |
- VE |
| 428 |
* - Vietnam |
| 429 |
- VN |
| 430 |
* - Yemen |
| 431 |
- YE |
| 432 |
* - Zimbabwe |
| 433 |
- ZW |
| 434 |
|
| 435 |
.. raw:: html |
| 436 |
|
| 437 |
</details> |
| 438 |
</br> |