youtube_api 0.7.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

Youtube API (youtube_api) #

pub package

A Flutter plugin for fetching interacting with Youtube Server to fetch data using API. Supports iOS and Android.

Features: #

  • Search Video, Playlist, Channel on youtube.
  • Play Youtube Video [Coming Soon]

Usage #

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

Complete Example Code

Example #

alt text


static String key = 'YOUR_API_KEY';
YoutubeAPI ytApi = new YoutubeAPI(key);
List<YT_API> ytResult = [];

String query = "Flutter";
ytResult = await ytApi.Search(query);
// data which are available in ytResult are shown below 

These data are stored in ytResult

[
    {
        "kind": "video",
        "id": "9vzd289Eedk",
        "channelTitle": "Java",
        "title": "WEBINAR - Programmatic Trading in Indian Markets using Python with Kite Connect API",
         "description": "For traders today, Python is the most preferred programming language for trading, as it provides great flexibility in terms of building and executing strategies.",
        "publishedAt":"2016-10-18T14:41:14.000Z",
        "channelId": "UC8kXgHG13XdgsigIPRmrIyA",
        "thumbnails": {
             "default": {
              "url": "https://i.ytimg.com/vi/9vzd289Eedk/default.jpg",
              "width": 120,
              "height": 90
             },
             "medium": {
              "url": "https://i.ytimg.com/vi/9vzd289Eedk/mqdefault.jpg",
              "width": 320,
              "height": 180
             },
             "high": {
              "url": "https://i.ytimg.com/vi/9vzd289Eedk/hqdefault.jpg",
              "width": 480,
              "height": 360
             }
        },
        "channelurl":"https://www.youtube.com/channel/UC8kXgHG13XdgsigIPRmrIyA",
        "url":"https://www.youtube.com/watch?v=9vzd289Eedk"
    },
    {
      "kind": "video"
       // Here will you next result
    },
    {
       // Here will you next result
    },
    {
       // Here will you next result
        "url":"https://www.youtube.com/watch?v=9vzd289Eedk"
    }
 ]

Default per-page result is 10 .

If you want search any specif out i.e video or playlist or channel. For Channel only specify > Type : "channel"

For Video only specify > Type : "video"

For Playlist only specify > Type : "playlist"

maxResults(int) can be 1 - 50


int max = 25;

String type = "channel";

YoutubeAPI ytApi = new YoutubeAPI(key,
                                  maxResults: max,
                                  Type: type);

Note: This plugin is still under development, and some APIs might not be available yet. Feedback welcome and Pull Requests are most welcome!

[0.1.1] - May 09th 2018

  • Readme Updated

[0.1.0] - May 09th 2018

  • Initial Open Source release.

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


dependencies:
  youtube_api: ^0.7.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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_api/youtube_api.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
85
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/youtube_api.dart. (-1 points)

Analysis of lib/youtube_api.dart reported 2 hints:

line 9 col 30: The value of the field '_channel' isn't used.

line 153 col 7: Name types using UpperCamelCase.

Fix lib/generated/i18n.dart. (-0.50 points)

Analysis of lib/generated/i18n.dart reported 1 hint:

line 29 col 7: Name types using UpperCamelCase.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
http ^0.12.0+1 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8