youtube_video_validator 1.1.0

Youtube Video Validator #

A simple dart class for validate Video URL and ID on Youtube. Can be used within Flutter apps.

Installation #

Dart requires the latest version of Dart. You can download the latest and greatest here.

1. Depend on it #

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

dependencies:
    youtube_video_validator: '^1.1.0'

2. Install it #

You can install packages from the command line:

$ pub get
..

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

3. Import it #

Now in your Dart code, you can use:

import 'package:youtube_video_validator/youtube_video_validator.dart';

Usage #

Read the unit tests under test, or see code example below:

// validate video URL
var ytVideo = 'https://www.youtube.com/watch?v=ou6Tt5w9B-Y';
assert(YoutubeVideoValidator.validateUrl(ytVideo));
// validate video ID
var ytVideoID = 'ou6Tt5w9B-Y';
assert(await YoutubeVideoValidator.validateID(ytVideoID));
// validate video ID and grab video data
var ytVideoID = 'ou6Tt5w9B-Y';
  if (await YoutubeVideoValidator.validateID(ytVideoID, loadData: true)) {
    print('Title: ${YoutubeVideoValidator.video.title}');
    print('Views: ${YoutubeVideoValidator.video.views}');
    print('Length (seconds): ${YoutubeVideoValidator.video.length}');
    print('Link: ${YoutubeVideoValidator.video.shareUrl()}');
  }

Tips #

You can also use this repo as a template for creating Dart packages, just clone the repo and start hacking :)

1.1.0 #

  • validateID now grab the video data like: id, title, length, views, channelID, author (channel name), description, tags, thubmnail and rating.

1.0.0 #

  • First release

example/README.md

Examples #

Use this package as a library

1. Depend on it

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


dependencies:
  youtube_video_validator: ^1.1.0

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_video_validator/youtube_video_validator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.0 <3.0.0
http ^0.12.0+4 0.12.0+4
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.12
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
test 1.12.0