youtube_explode_dart_plus 1.0.2 copy "youtube_explode_dart_plus: ^1.0.2" to clipboard
youtube_explode_dart_plus: ^1.0.2 copied to clipboard

A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key.

example/example.dart

import 'package:youtube_explode_dart_plus/youtube_explode_dart_plus.dart';

Future<void> main() async {
  final yt = YoutubeExplode();

  // Get the video metadata.
  final video = await yt.videos.get('fRh_vgS2dFE');
  print(video.title); // ^ You can pass both video URLs or video IDs.

  final manifest = await yt.videos.streams.getManifest(
    'fRh_vgS2dFE',
    // You can also pass a list of preferred clients, otherwise the library will handle it:
    ytClients: [YoutubeApiClient.ios, YoutubeApiClient.androidVr],
  );

  // Print all the available streams.
  print(manifest);

  // Get the audio streams.
  final audio = manifest.audioOnly;

  // Download it
  final stream = yt.videos.streams.get(audio.first);
  // then pipe the stream to a file...

  // Or you can use the url to stream it directly.
  audio.first.url; // This is the audio stream url.

  // Make sure to handle the file extension properly. Especially m3u8 streams might require further processing.

  // Close the YoutubeExplode's http client.
  yt.close();
}
0
likes
140
points
65
downloads

Publisher

unverified uploader

Weekly Downloads

A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key.

Topics

#youtube #video #streams

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, freezed_annotation, html, http, http_parser, json_annotation, logging, meta, unicode, xml

More

Packages that depend on youtube_explode_dart_plus