, OAuth, API, , . :
https://console.developers.google.com API API Youtube v3. API, OAuth ClientId. API : "AISdkJKdk7GuSkDKJDKSkLmSSdDFm4ro4E_4et_ww"
# Google.Apis.YouTube.v3 1.40.2.1593 Nuget. , .
You Tube "Unlisted Videos, API" ( YouTube, , , . )
. , , , , , .
, , , . URL, , & list, . : https://www.youtube.com/watch?v=kskScbSkdSDg&list=DKfiVi8sZdkZqW-saZt7bN8DDTDxshjDK. (PlalistId) - DKfiVi8sZdkZqW-saZt7bN8DDTDxshjDK, GetPlaylistVideos.
. :
public static List<YouTubeVideo> GetPlaylistVideos(string PlaylistId)
{
List<YouTubeVideo> result = new List<YouTubeVideo>();
try
{
YouTubeService service = new YouTubeService(new BaseClientService.Initializer()
{
ApplicationName = YOUTUBE_APPLICATION_NAME,
ApiKey = YOUTUBE_API_KEY
});
var nextPageToken = "";
while (nextPageToken != null)
{
var playlistItemsListRequest = service.PlaylistItems.List("snippet");
playlistItemsListRequest.PlaylistId = PlaylistId;
playlistItemsListRequest.MaxResults = 50;
playlistItemsListRequest.PageToken = nextPageToken;
var playlistItemsListResponse = playlistItemsListRequest.Execute();
foreach (var playlistItem in playlistItemsListResponse.Items)
{
YouTubeVideo v = new YouTubeVideo
{
EmbedUrl = String.Format("https://www.youtube.com/embed/{0}", playlistItem.Snippet.ResourceId.VideoId),
Title = playlistItem.Snippet.Title,
Description = playlistItem.Snippet.Description,
ThumbnailUrl = playlistItem.Snippet.Thumbnails.High.Url
};
result.Add(v);
}
nextPageToken = playlistItemsListResponse.NextPageToken;
}
}
If you call GetPlaylistVideos, you will see that it returns unregistered videos from your unregistered playlist using the API key, not OAuth.
source
share