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

How to Add All Videos from a Channel to a Playlist

$
0
0

According to this answer [1], YouTube Watch Later access through YouTube API v3 seems very limited, so I think I'm going to restrict this question to adding to a playlist instead.

Anyways, this is what I think the workflow to achieve this would be:

  1. Loop through the pages of videos in a channel with YouTube API. Something like this:

    https://www.googleapis.com/youtube/v3/channels?part=contentDetails&key={{YOUTUBE_API_KEY}}&forUsername={{CHANNEL_USERNAME}}&order=date&maxResults=50

    But I'm getting a weird response like this (I used Veritasium's channel for this example):

    {"kind": "youtube#channelListResponse","etag": "rKBMFgDUZ01YcV1szgI433m_NI4","pageInfo": {"totalResults": 1,"resultsPerPage": 50    },"items": [        {"kind": "youtube#channel","etag": "fdmldzetq8235Eh_T--brsjat6M","id": "UCHnyfMqiRRG1u-2MsSQLbXA","contentDetails": {"relatedPlaylists": {"likes": "","uploads": "UUHnyfMqiRRG1u-2MsSQLbXA"                }            }        }    ]}
  2. Use YouTube API to add all videos to a playlist (need OAuth key?). Is it even possible?

If you can, I would greatly appreciate a script for this. I personally typically use TypeScript or Bash for doing these types of scripts, but whatever language will suffice.


References

  1. Is there a way to get the "Watch Later" playlist using YouTube API v3?
  2. YouTube API to fetch all videos on a channel
    • The answers on this one seem very odd, cause the question is about all videos on a channel, but the answers are mostly about all videos in playlists.

Viewing all articles
Browse latest Browse all 3831

Trending Articles



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