搜尋套件、儲存庫與 APP 分類

youtube_api 封面
套件詳情v1.0.4

youtube_api

YouTubeAPI 是一個直接與 YouTube 伺服器互動的外掛程式。支援搜尋影片和播放清單。

近 30 天下載
173
喜歡數
85
Pub 分數
100

安裝套件

flutter pub add youtube_api

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

YouTubeAPI 是一個 Flutter 插件,可直接與 YouTube 伺服器互動,讓開發者能夠搜尋影片和播放清單。此插件以簡單與效率為設計目標,能無縫整合至 Flutter 應用程式中,提供 YouTube 核心搜尋功能的存取,且無需複雜設定。該插件由 nstack.in 維護,並託管於 GitHub,方便開源貢獻。支援 Android 與 iOS 平台,但元資料中未列出特定平台細節。

適用情境

  • 將 YouTube 影片搜尋整合到應用程式中
  • 透過程式化方式取得播放清單資料
  • 建構媒體發現功能
  • 建立影片推薦系統
  • 啟用使用者驅動的內容探索

主要特色

  • 直接YouTube伺服器通訊
  • 影片與播放清單搜尋功能
  • 與 Flutter 的簡單整合
  • GitHub 上的開源程式碼庫
  • 跨平台支援(Android/iOS)

適合對象

  • 開發媒體豐富的 Flutter 應用的開發者
  • 需要 YouTube 內容發現的應用
  • 需要即時影片搜尋的專案
  • 開源影片工具貢獻者
  • 教育或娛樂應用開發者

使用建議

  • 需要互聯網連接以進行API呼叫
  • 取決於YouTube公開API的可用性
  • 生產使用可能需要API金鑰配置
  • 僅限搜尋功能(無播放控制)
  • 元數據中未提供官方文件

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。