RobbieClarken / youtube-channel-to-playlist

Add all videos from a YouTube channel to a playlist
MIT License
30 stars 3 forks source link

Error opening client_secrets.json #7

Open allthepreaching opened 3 years ago

allthepreaching commented 3 years ago

Please see example below. Is there a specific location the json file needs to be in? Currently it is in my downloads folder. Please let me know what I can do to get this to work. Thank you so much for creating this!

C:\Users\HP>channel_to_playlist --secrets client_secrets.json https://www.youtube.com/c/BlessedHopeBaptistChurchSydney/videos https://www.youtube.com/playlist?list=PLaEnjcaR3I7fOtDggi2NiqrgW1S2vT-Ap

The client secrets were invalid:

('Error opening file', 'client_secrets.json', 'No such file or directory', 2)

Missing client_secrets.json file.

Download from https://console.developers.google.com/project/YOUR_PROJECT_ID/apiui/credential.

allthepreaching commented 3 years ago

OK I got everything figured out and working. But now I get KeyError: 'items'. See info below:

C:\Users\HP\Documents>channel_to_playlist --noauth_local_webserver --logging_level INFO --secrets client_secrets.json https://www.youtube.com/c/BlessedHopeBaptistChurchSydney https://www.youtube.com/playlist?list=PLaEnjcaR3I7fOtDggi2NiqrgW1S2vT-Ap Traceback (most recent call last): File "C:\Users\HP\AppData\Local\Programs\Python\Python310\Scripts\channel_to_playlist-script.py", line 33, in sys.exit(load_entry_point('YouTubeChannelToPlaylist==3.0.0', 'console_scripts', 'channel_to_playlist')()) File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\site-packages\channel_to_playlist.py", line 166, in main channel_playlist_id = get_channel_upload_playlist_id( File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\site-packages\channel_to_playlist.py", line 53, in get_channel_upload_playlist_id return channel_response["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"] KeyError: 'items'

Any help is greatly appreciated!

RobbieClarken commented 5 months ago

Hi @allthepreaching , when invoking you need to supply the channel id and and playlist id, not the urls:

channel_to_playlist --secrets client_secrets.json UCq_kzFkt5tAqtP94MgT3SUw PLaEnjcaR3I7fOtDggi2NiqrgW1S2vT-Ap

It would be a nice feature to support the user supplying the channel/playlist urls instead of ids. If I ever get time I might add this.