Closed orschiro closed 5 years ago
Hi @orschiro - the problem looks to be you are using Python 2.7 and the code is only compatible with Python 3.6+ (I will update the readme to specify this). It is usually not too much trouble to install Python 3 alongside Python 2. I personally use pyenv to manage multiple Python versions.
Thanks @RobbieClarken! Tried the same with pip3
. Can you help me with this error now?
[orschiro@x230 youtube-channel-to-playlist]$ channel_to_playlist --secrets client_secrets.json UCeZzpJTrjHgTDCJp0X0Ta8g PLj5bhjq9U0_adeAmPmQZxGqAR2hzSnZqr
Adding video 1 of 1443Traceback (most recent call last):
File "/usr/local/bin/channel_to_playlist", line 11, in <module>
load_entry_point('YouTubeChannelToPlaylist==2.0.0', 'console_scripts', 'channel_to_playlist')()
File "/usr/local/lib/python3.6/site-packages/channel_to_playlist.py", line 127, in main
add_to_playlist(youtube, args.playlist_id, video_ids, f, args.allow_duplicates)
File "/usr/local/lib/python3.6/site-packages/channel_to_playlist.py", line 90, in add_to_playlist
add_video_to_playlist(youtube, playlist_id, video_id)
File "/usr/local/lib/python3.6/site-packages/channel_to_playlist.py", line 70, in add_video_to_playlist
"resourceId": {"videoId": video_id, "kind": "youtube#video"},
File "/usr/local/lib/python3.6/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&alt=json returned "Forbidden">
I'm not really sure what is going on now. Is the playlist (PLj5bhjq9U0_adeAmPmQZxGqAR2hzSnZqr
) created by the same user that was used to generate client_secrets.json
? I tested adding videos from channel UCeZzpJTrjHgTDCJp0X0Ta8g
to a playlist I created and it worked. Perhaps try with a different different playlist or regenerating the client credentials?
Dear @RobbieClarken, now it seems to be working.
I redid the entire process and ensured that I was logged in with the same (email) account under Google Developer console and YouTube.
First time I tried it, I was logged into the Developer Console with my Gmail account but with a YouTube Channel (?) account. For the latter, I am manager with my Gmail account. It's a bit of mess with those different accounts that Google / Gmail / YouTube has.
Thanks for all your advice and support! :-)
Dear @RobbieClarken,
I am trying to get your script to work. However, it raises below error although the playlist is empty:
https://www.youtube.com/playlist?list=PLj5bhjq9U0_adeAmPmQZxGqAR2hzSnZqr&disable_polymer=true
Any ideas?
Yours