Youtube api 3.0用法

  • Post author:
  • Post category:其他


youtube api无法得到一个频道的所有视频,用playlistitems得到一个播放列表的snippet后还要逐个请求每个视频的时长,用videos方法

// subscriptions包括gaming,tvshows,music等等



public static String playlistHead =

“https://www.googleapis.com/youtube/v3/playlistItems?”



+ “part=snippet&key=xxxx”



+ “playlistId=”;



public static String allVideosToe = “&maxResults=50”;



public static String key = “xxxx”;



public static String form =

“https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLrEnWoR732

-BHrPp_Pm8_VleD68f9s14-&maxResults=50&key=AIzaSyB19AHY3Fpnd1_EE7TlQEcGnbbWB0weY4o”;

//


public static String allVideosHead =

“https://www.googleapis.com/youtube/v3/search?part=snippet”

//


+ “&order=date&key=AIzaSyB19AHY3Fpnd1_EE7TlQEcGnbbWB0weY4o”

//


+ “&channelId=”;



public static String gamingChannel = “PLiCvVJzBupKnKoAJR3T8NxXwA5mPeBD8W”;



/** Gaming */



// Gaming popular



public static String gamingPopular = playlistHead



+ “PLiCvVJzBupKnKoAJR3T8NxXwA5mPeBD8W”;



// Gaming recent 这个是gaming频道名,可以查询videos得到按发布先后排序的视频列表

//


public static String gamingRecent = allVideosHead

//


+ “PLiCvVJzBupKnKoAJR3T8NxXwA5mPeBD8W”;



// TVShows 这个没有播放列表,暂时放置



// 英文tvshows最受欢迎https://www.youtube.com/channel/SBkpb2ovTTnLQ/channels?

shelf_id=0&view=31



// 英文tvshows最新https://www.youtube.com/channel/SBkpb2ovTTnLQ/channels?

shelf_id=0&view=34



public static String tvShowsRecnet =

“https://www.youtube.com/user/YouTubeShowsUS/videos?shelf_id=0&view=36&sort=dd”;



public static String tvShowsPopular = “”;



// Live 也没有播放列表 有即将直播的活动和正在直播的活动



// Movies



public static String moviesRecent = playlistHead



+ “PLjygWhZE6KY09warO0vN6j2Is0YhK5A4G”;



// public static String moviesPopular = allVideosHead

//


+ “PLjygWhZE6KY09warO0vN6j2Is0YhK5A4G”;



// Education



public static String educationPopular = playlistHead



+ “PLN_VEYjh8gCByLq9iBB_yP4Qyhh95DMyH”;

//


public static String educationRecent = allVideosHead

//


+ “PLN_VEYjh8gCByLq9iBB_yP4Qyhh95DMyH”;



// Youtube News



// 新闻里面还有很多频道,每个频道有很多关于一条新闻的视频PL3ZQ5CpNulQmIWQxGOl3S-

LHAVc9UEbD9是1月3号的20条新闻



public static String newsPopular =

“https://www.youtube.com/channel/UCYfdidRxbB8Qhf0Nx7ioOYw/playlists?

sort=dd&view=50&shelf_id=901516243455573498″;



// Sports



public static String sportsRecent = playlistHead



+ “PL8fVUTBmJhHJDAtZwiIOooPRurN0hna-j”;



public static String sportsPopular = playlistHead



+ “PL8fVUTBmJhHJmpP7sLb9JfLtdwCmYX9xC”;



// Music



public static String musicPopular = playlistHead



+ “PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI”;



public static String musicRecent = playlistHead



+ “PLFgquLnL59alW3xmYiWRaoz0oM3H17Lth”;



// Popular On Youtube



public static String popularRecent = playlistHead



+ “PLrEnWoR732-BHrPp_Pm8_VleD68f9s14-“;

//


public static String popularPopular = allVideosHead

//


+ “UCF0pVplsI8R5kcAqgtoRqoA”;



版权声明:本文为erone原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。