Search packages, repositories and app categories

youtube_api cover
Package detailsv1.0.4

youtube_api

YouTubeAPI is a plugin which directly interacts with YouTube server. Supports Searching video and playlist.

30-day downloads
143
Likes
85
Pub points
100

Install package

flutter pub add youtube_api

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

YouTubeAPI is a Flutter plugin that enables direct interaction with the YouTube server, allowing developers to search for videos and playlists. Built for simplicity and efficiency, it integrates seamlessly into Flutter applications, providing access to YouTube's core search functionality without requiring complex setup. The plugin is maintained by nstack.in and hosted on GitHub, making it accessible for open-source contributions. It supports both Android and iOS platforms, though specific platform details are not listed in the metadata.

Use cases

  • Integrating YouTube video search into apps
  • Fetching playlist data programmatically
  • Building media discovery features
  • Creating video recommendation systems
  • Enabling user-driven content exploration

Key features

  • Direct YouTube server communication
  • Video and playlist search capabilities
  • Simple integration with Flutter
  • Open-source codebase on GitHub
  • Cross-platform support (Android/iOS)

Suitable for

  • Developers building media-rich Flutter apps
  • Apps requiring YouTube content discovery
  • Projects needing real-time video search
  • Open-source contributors to video tools
  • Educational or entertainment app creators

Considerations

  • Requires internet connection for API calls
  • Depends on YouTube's public API availability
  • May need API key configuration for production use
  • Limited to search functionality (no playback control)
  • No official documentation provided in metadata

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

YouTube API Client (youtube_api_client)

Forked (all restructured and improved) from youtube_api

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 (query by keywords or by ID)
  • Get Trending Videos based on region code.

Usage

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

Complete Example Code

Example
static String key = "YOUR_API_KEY";
final youtube = YoutubeApi(_key);
List<ApiResult> result = [];

Search for videos, channels and playlists

String query = "Flutter";
result = await youtube.search(query);
// data which are available in result is typed as in the example shown below

By default the search options are like the following:

SearchOptions options = const SearchOptions(
      type: ResultType.values,
      order: Order.relevance,
      videoDuration: VideoDuration.any,
    )

But you can customize them changing the parameter options. For example, if you want to get only results for channels, you can specify like so:

SearchOptions(type: ResultType.channel)

To get Trending videos in your Country-

regionCode='YOUR_COUNTRY_REGION_CODE(apha-2)';
result = await youtube.getTrends(regionCode);
//make sure you assign alpha-2 region code

To get results by id use searchVideosById, searchChannelsById, and searchPlaylistsById.

result = await youtube.searchVideosById(idList);

You can find your Country Region Code here

By default, it retrieves only the "snippet" data, which has enough information for most of the cases.

For example the snippet for a video contains:

  1. title (String)
  2. description (String)
  3. publish date (DateTime)
  4. channel ID (String)
  5. channel title (String)
  6. thumbnails (Map<ThumbnailResolution, Thumbnail> - custom classes)
  7. video category (Category - enum)
  8. tags (List)
  9. default language (String)
  10. defaultAudioLanguage (String)
  11. live broadcast content (LiveBroadcastContent - enum)

If you need more information from the API, you can add other parts in the query. For now it has only the part "snippet" and "content details" (containing: duration, dimension, definition, caption, licensed content, and projection). The original API has lots more of information, so you are welcome to help implementing those making pull requests.

Motivation

The original package seems to be abandoned. I improved a lot its code, making it more typed, and added more features.

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.