youtube_data_api 1.0.0 copy "youtube_data_api: ^1.0.0" to clipboard
youtube_data_api: ^1.0.0 copied to clipboard

outdated

A new Flutter plugin for Youtube.

YouTube Data API #

pub package

A Flutter plugin for fetching complete data from YouTube to fetch data. Supports iOS and Android.

Features #

  • Search Video, Playlist, Channel on YouTube with (Unlimited Videos With Loading More) feature.
  • Get Video Data, Id, Thumbnail, Channel Name, Views, Likes
  • Get Related Videos with a video
  • Get Playlist Videos with (Loading More) feature
  • Get Channel complete data (Name, Id, Banner, Avatar, Videos Count, Subscribers Count, Videos with (Loading More) feature)
  • Search Suggestions
  • Get Trending Videos based on your ip country (Trending, Music, Gaming, Movies).

Usage #

To use this plugin, add youtube_data_api as a dependency in your pubspec.yaml file.

Complete Example Code

Example #

To search for videos or channels or playlists

String query = "Wegz";
YoutubeDataApi youtubeDataApi = YoutubeDataApi();
List videoResult = await youtubeDataApi.fetchSearchVideo(query);
videoResult.forEach((){
    if(videoResult![index] is Video){
      Video video = videoResult![index];
    } else if(videoResult![index] is Channel){
      Channel channel = videoResult![index];
    } else if(videoResult![index] is PlayList){
      PlayList playList = videoResult![index];
    }
});

To get trending videos

YoutubeDataApi youtubeDataApi = YoutubeDataApi();
List<Video> videos = await youtubeDataApi.fetchTrendingVideo();

To get gaming, music, movies videos on trend

List<Video> videos = await youtubeDataApi.fetchTrendingMusic();

To get suggestion search queries

String query = "El Joker";
List<String> suggestions = await youtubeDataApi.fetchSuggestions(query);

To get video data

Future<VideoData?> videoData = await youtubeDataApi.fetchVideoData(videoId);
String? videoTitle = videoData?.video?.title;
String? videoChannelName = videoData?.video?.username;
String? viewsCount = videoData?.video?.viewCount;
String? likeCount = videoData?.video?.likeCount;
String? channelThumbnail = videoData?.video?.channelThumb;
String? channelId = videoData?.video?.channelId;
String? subscribeCount = videoData?.video?.subscribeCount;
List<Video> relatedVideos = videoData?.videosList;