I wrote a little script that gets me a video-Id from Youtube that I want to add to a playlist. Now I tried to execute the following:
#add to playlist
url_post='https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key='+key
data={"snippet": {
"playlistId": playListId,
"resourceId": {
"videoId": videoId,
"kind": "youtube#video"
}
}
}
data_json=json.dumps(data)
response=requests.post(url_post, data=data_json)
I got a 401-Unauthorized and read the following link https://developers.google.com/youtube/v3/docs/playlistItems/insert where is mentioned, that I have to authenticate with OAuth. So I created some OAuth 2.0-Client-IDs in https://console.developers.google.com.
But now I don't have any clue how to use OAuth to get this working in Pythonista.
So how can I authenticate at Youtube to add a Video to my playlist?