Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Adding multiple videos to youtube-playlist in single api request (Python)

$
0
0

So I have this script that extracts users liked videos and creates a public playlist containing all liked videos but since there's quota limits I can't add more than 200 videos per day (playlistItems().insert() costs 50 quota /10,000).

Is there any way I can add videos in batches of 50 or something to avoid running out of quota ?

my current code:

youtube = googleapiclient.discovery.build("youtube", "v3", credentials=credentials)#code for fetching video id's in a list...video_ids= [id1,id2,id3,id4,...]playlist_id= "<playlist id>"for id in video_ids:    youtube.playlistItems().insert(        part="snippet",        body={"snippet": {"playlistId": playlist_id,"resourceId": {"kind": "youtube#video","videoId": id                }            }        }    ).execute()

I've heard there's batch = youtube.new_batch_http_request() but this doesn't seem to work for me, adds only 1 video and I think this still costs same amount of quota as above code.


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>