Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added quota testing #400

Closed
wants to merge 1 commit into from
Closed

Added quota testing #400

wants to merge 1 commit into from

Conversation

jahenner
Copy link

@jahenner jahenner commented Jun 17, 2023

I added code for checking the quotas for each of the endpoints. Below is the output I received. I'm not sure how you want to interpret the results and where you would best like them.

Running the script

To run the script make sure to have your oauth.json in the main directory. Then run the command python3 quotas.py

Output

Testing endpoint data for search
Testing endpoint data for get_search_suggestions
Final quotas for search endpoints
search endpoint has an API quota of 5678
get_search_suggestions endpoint has an API quota of 16021
Testing endpoint data for get_home
Testing endpoint data for get_artist
Testing endpoint data for get_artist_albums
Testing endpoint data for get_album
Testing endpoint data for get_album_browse_id
Testing endpoint data for get_user
Testing endpoint data for get_user_playlists
Testing endpoint data for get_song
Testing endpoint data for get_song_related
Error occured for get_song_related
'sectionListRenderer'
Testing endpoint data for get_lyrics
Testing endpoint data for get_tasteprofile
Testing endpoint data for set_tasteprofile
Error occured for get_artist_albums
'content'
Error occured for get_user_playlists
'gridRenderer'
Final quotas for browse endpoints
get_home endpoint has an API quota of 3550
get_artist endpoint has an API quota of 9041
get_artist_albums endpoint has an API quota of 329
get_album endpoint has an API quota of 11160
get_album_browse_id endpoint has an API quota of 9410
get_user endpoint has an API quota of 11796
get_user_playlists endpoint has an API quota of 282
get_song endpoint has an API quota of 11721
get_song_related endpoint has an API quota of 0
get_lyrics endpoint has an API quota of 12103
get_tasteprofile endpoint has an API quota of 4584
set_tasteprofile endpoint has an API quota of 3527
Testing endpoint data for get_mood_categories
Testing endpoint data for get_mood_playlists
Testing endpoint data for get_charts
Error occured for get_charts
list index out of range
Error occured for get_mood_playlists
Server returned HTTP 503: Service Unavailable.
The service is currently unavailable.
Final quotas for explore endpoints
get_mood_categories endpoint has an API quota of 8476
get_mood_playlists endpoint has an API quota of 1352
get_charts endpoint has an API quota of 180
Testing endpoint data for get_watch_playlist
Final quotas for watch endpoints
get_watch_playlist endpoint has an API quota of 2593
Testing endpoint data for get_library_playlists
Testing endpoint data for get_library_songs
Testing endpoint data for get_library_albums
Testing endpoint data for get_library_artists
Testing endpoint data for get_library_subscriptions
Testing endpoint data for get_liked_songs
Testing endpoint data for get_history
Testing endpoint data for rate_song
Testing endpoint data for edit_song_library_status
Testing endpoint data for rate_playlist
Error occured for rate_playlist
Server returned HTTP 400: Bad Request.
Request contains an invalid argument.
Testing endpoint data for subscribe_artists
Testing endpoint data for unsubscribe_artists
Error occured for unsubscribe_artists
Server returned HTTP 429: Too Many Requests.
Resource has been exhausted (e.g. check quota).
Error occured for subscribe_artists
Server returned HTTP 429: Too Many Requests.
Resource has been exhausted (e.g. check quota).
Error occured for get_library_subscriptions
Server returned HTTP 500: Internal Server Error.
Internal error encountered.
Error occured for get_library_playlists
Server returned HTTP 500: Internal Server Error.
Internal error encountered.
Error occured for get_library_artists
Server returned HTTP 499: Client Closed Request.
The operation was cancelled.
Error occured for get_history
None
Final quotas for library endpoints
get_library_playlists endpoint has an API quota of 2164
get_library_songs endpoint has an API quota of 11975
get_library_albums endpoint has an API quota of 15531
get_library_artists endpoint has an API quota of 8697
get_library_subscriptions endpoint has an API quota of 4144
get_liked_songs endpoint has an API quota of 9182
get_history endpoint has an API quota of 3393
rate_song endpoint has an API quota of 18429
edit_song_library_status endpoint has an API quota of 17838
rate_playlist endpoint has an API quota of 0
subscribe_artists endpoint has an API quota of 2254
unsubscribe_artists endpoint has an API quota of 4
Testing endpoint data for get_playlist
Testing endpoint data for create_playlist
Testing endpoint data for edit_playlist
Testing endpoint data for add_playlist_items
Testing endpoint data for remove_playlist_items
Testing endpoint data for delete_playlist
Error occured for create_playlist
Server returned HTTP 400: Bad Request.
You are creating too many playlists. Please wait a while before creating further playlists.
Final quotas for playlists endpoints
get_playlist endpoint has an API quota of 7508
create_playlist endpoint has an API quota of 26
edit_playlist endpoint has an API quota of 26
add_playlist_items endpoint has an API quota of 26
remove_playlist_items endpoint has an API quota of 26
delete_playlist endpoint has an API quota of 26

Copy link
Owner

@sigma67 sigma67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for you contribution! Some questions are left, but I believe we can merge this.

First, are these quotas reproducible? I.e., can you run the script multiple times with the same result? If not, what is the range for these values?

Finally, once you have obtained a range with high confidence, can you add the obtained values to a separate page in the documentation?

(ytmusic.get_tasteprofile, {}),
(ytmusic.set_tasteprofile, {
"artists": ["Leo Dan"],
"taste_profile": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract this to a JSON file, it's making the code very hard to read

@sigma67 sigma67 linked an issue Jul 20, 2023 that may be closed by this pull request
@AustinGitHub
Copy link
Contributor

So for search once you reach that quota, do you need to redo the oauth to like reset it or is there like a cooldown? I'm building a script to sort of do a ton of search calls and want to understand this a bit. Thanks!

@sigma67
Copy link
Owner

sigma67 commented Jan 14, 2024

Don't know if you can reset it tbh. Feel free to experiment and report back, I personally never hit the limit despite doing hundreds to thousands of searches per hour (which makes sense considering the limit according to the PR is >5000)

@jahenner
Copy link
Author

jahenner commented Jan 15, 2024 via email

@sigma67 sigma67 deleted the branch sigma67:master January 21, 2024 17:50
@sigma67 sigma67 closed this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API quota values
3 participants