问题
I am trying to get the list of the videos for a specific channel by specifying the channel ID. I used the search but it worked only for public videos. I need to get this list (especially of unlisted videos) either by HTTP requests, or the SDK (NuGet package in C#) preferably. Please note that these unlisted videos may not be in a playlist, so I need a generic solution solely based on channel ID if it exists. Also, I am authenticating as a user who owns/posted those unlisted videos, if that'll make any difference.
回答1:
Please note that without proper authorization, one cannot list non-public video meta-data.
For to list a given channel's video meta-data, you may employ the PlaylistItems.list API endpoint queried with the parameter playlistId set to the ID of that channel's uploads playlist.
This latter ID may very easily be obtained by invoking the Channels.list endpoint queried with the parameter id set to your channel's ID or, otherwise, by passing on the parameter mine as mine=true
.
The uploads playlist ID is then to be found within the endpoint's JSON response as value of the property items[0].contentDetails.relatedPlaylists.uploads. Note that for a given channel, you need to obtain the uploads playlist ID only once, then use it as many times as you wish.
Usually, a channel ID and its corresponding uploads playlist ID are related by s/^UC([0-9a-zA-Z_-]{22})$/UU\1/
.
来源:https://stackoverflow.com/questions/63810943/youtube-private-unlisted-videos-by-channel-id