youtube_data_v3 0.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

youtube_data_v3 #

pub package

Package contains functions to access Youtube Data API V3 via the API key.

The package uses Api's with parameters having less quota's.

Features #

  • Channel & videos from channel id.

Usage #

To use this plugin add 'youtube_data_v3' as a dependency in pubspec.yaml file.

Example #

import 'package:youtube_data_v3/youtube_data_v3.dart';
import 'package:youtube_data_v3/youtube_channel.dart';
import 'package:youtube_data_v3/youtube_video.dart';

final ytApi = YoutubeV3();
ytApi.init("API KEY");
YtChannel channel = await ytApi.getChannelFromId("CHANNEL ID");
//Get title of channel
//Get the channel uploads(All the videos in a channel) id
//Get the channel Description
//Get the channel url
//Get the channel thumbnail
ThumbnailDetails channelTumbnail = channel.thumbnailDetails;
//Get the channel publised date
DateTime chPubTime = channel.publishedAt;
//Get google youtube api channel
Channel gApi = channel.gApiChannel;

//Get the first page of videos from channel. Optional: Max num of Results, Optional: get duration of video also (defaults to false)
List<YtVideo> videoList = await channel.getPageOfVideos(numResults: 10, showDuration: true);

//Shows the next page of videos from the last time a call was made to getPageOfVideos
videoList = await channel.getPageOfVideos(numResults: 10, showDuration: true, showNextPage: true);
//gives previous page of videos from the last time a call was made to getPageOfVideos
videoList = await channel.getPageOfVideos(numResults: 10, showDuration: true, showPrevPage: true);

//Get title of video
//Position of video in the list of videos received
//Get duration of video
print(videoList[0].duration);//Showed as 10:41 or 1:10:41
//Get description
//Get Video id
//Get thumbnail
ThumbnailDetails videoThumbnail = videoList[0].thumbnailDetails;
// Get published date
DateTime vidPubTime = videoList[0].publishedAt;
//Get channel id
//Get playlist id of the video
//Get google youtube api video item
PlaylistItem videoItem = videoList[0].videoItem;

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - 3.6.2019

  • Initial Release

[0.0.1+1] - 4.6.2019

  • Updated readme and added example (No change in public API)


import 'package:youtube_data_v3/youtube_data_v3.dart';
import 'package:youtube_data_v3/youtube_channel.dart';
import 'package:youtube_data_v3/youtube_video.dart';

main(List<String> arguments) async {

  const String API_KEY = "";// API key from Google console
  const String CHANNEL_ID = "";// Channel Id of the youtube channel to fetch videos from

  final ytApi = YoutubeV3();
  YtChannel channel = await ytApi.getChannelFromId(CHANNEL_ID);

  List<YtVideo> videoList = await channel.getPageOfVideos(numResults: 10, showDuration: true);

  //title of the video
  //position of the video in the list of videos from the page received
  //duration of the video (only present when show duration is set to true)

  //Url of the thumbnail of the video

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  youtube_data_v3: ^0.0.1+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:youtube_data_v3/youtube_data_v3.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

52 out of 52 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/youtube_channel.dart.

Run flutter format to format lib/youtube_channel.dart.

Format lib/youtube_data_v3.dart.

Run flutter format to format lib/youtube_data_v3.dart.

Format lib/youtube_video.dart.

Run flutter format to format lib/youtube_video.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (googleapis).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
googleapis ^0.53.0 0.53.0 0.54.0
googleapis_auth ^0.2.7 0.2.11+1
http ^0.12.0+2 0.12.0+4
Transitive dependencies
_discoveryapis_commons 0.1.9
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies