youtube_extractor 1.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new75

YouTube Extractor

Pub

YouTube Extractor is a library for Dart (and Flutter) that provides an interface to resolve and download YouTube video and audio streams. This library is being primarily developed to provide YouTube support for the mobile SoundByte apps.

YouTube Extractor is a port of YouTubeExplode for Dart (minus some extra features that were not needed).

Features

  • Download YouTube audio and video streams.
  • Access the YouTube live steaming url.

Usage

YouTube Extractor has a single entry point, the YouTubeExtractor class. See the example folder for more information.

Get an audio stream

import 'package:youtube_extractor/youtube_extractor.dart';

var extractor = YouTubeExtractor();

main() async {
  // Get the stream info for the passed video
  var streamInfo = await extractor.getMediaStreamsAsync('a1ExYqrBJio');
  
  // Print the audio stream url
  print('Audio URL: ${streamInfo.audio.first.url}');
}

1.0.1

  • Fixed crash caused by YouTube API change.

1.0.0

  • Library now follows standard practices.
  • Reuse http client for all requests.
  • Rename main method.
  • Added Dash support.
  • Fixed misc bugs.

0.1.1

  • Import dart:async.
  • Fix typos.
  • Run dartfmt.

0.1.0

  • Initial beta release.

example/example.dart

// This file shows a demostration on how to use the library.
import 'package:youtube_extractor/youtube_extractor.dart';

var extractor = YouTubeExtractor();

main() async {
  // Get and print the audio info for the passed video (music video)
  var musicVideoInfo = await extractor.getMediaStreamsAsync('52nfjRzIaj8');
  print('Music Video Audio URL: ${musicVideoInfo.audio.first.url}');

  // Get and print the audio info for the passed video (music)
  var audioInfo = await extractor.getMediaStreamsAsync('a1ExYqrBJio');
  print('Audio URL: ${audioInfo.audio.first.url}');

  // Get and print the video info for the passed video (ltt)
  var videoInfo = await extractor.getMediaStreamsAsync('j3YQAoN2wGM');
  print('Video URL: ${videoInfo.video.first.url}');

  // Get information for a live YouTube video
  var livestream = await extractor.getMediaStreamsAsync('mSQIX_G3TjU');
  print('Livestream URL: ${livestream.hlsLiveStreamUrl}');

  // Another test
  var previousBrokenStream = await extractor.getMediaStreamsAsync('m7Bc3pLyij0');
  print('Previous Broken Stream URL: ${previousBrokenStream.audio.first.url}');

  var previousBrokenStream2 = await extractor.getMediaStreamsAsync('Soa3gO7tL-c');
  print('Previous Broken Stream 2 URL: ${previousBrokenStream2.audio.first.url}');

  var previousBrokenStream3 = await extractor.getMediaStreamsAsync('YQHsXMglC9A');
  print('Previous Broken Stream 3 URL: ${previousBrokenStream3.audio.first.url}');
}

Use this package as a library

1. Depend on it

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


dependencies:
  youtube_extractor: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:youtube_extractor/youtube_extractor.dart';
  
Version Uploaded Documentation Archive
1.0.1 Nov 7, 2018 Go to the documentation of youtube_extractor 1.0.1 Download youtube_extractor 1.0.1 archive
1.0.0 Oct 30, 2018 Go to the documentation of youtube_extractor 1.0.0 Download youtube_extractor 1.0.0 archive
0.1.1 Oct 29, 2018 Go to the documentation of youtube_extractor 0.1.1 Download youtube_extractor 0.1.1 archive
0.1.0 Oct 29, 2018 Go to the documentation of youtube_extractor 0.1.0 Download youtube_extractor 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
50
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]
75
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:youtube_extractor/youtube_extractor.dart.

Health suggestions

Format lib/src/internal/parsers/player_source_parser.dart.

Run dartfmt to format lib/src/internal/parsers/player_source_parser.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.12.0 0.12.0
xml ^3.2.3 3.2.3
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
petitparser 2.0.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6