Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nstack-in/youtube_api
This Plugin will help you in fetching data from Youtube. You just need YOUTUBE API KEY.
https://github.com/nstack-in/youtube_api
flutter flutter-plugins playlist video youtube-api youtube-search
Last synced: 28 days ago
JSON representation
This Plugin will help you in fetching data from Youtube. You just need YOUTUBE API KEY.
- Host: GitHub
- URL: https://github.com/nstack-in/youtube_api
- Owner: nstack-in
- License: other
- Created: 2018-05-09T10:05:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-19T12:33:23.000Z (8 months ago)
- Last Synced: 2024-09-29T03:40:10.454Z (about 1 month ago)
- Topics: flutter, flutter-plugins, playlist, video, youtube-api, youtube-search
- Language: Dart
- Homepage:
- Size: 1.05 MB
- Stars: 55
- Watchers: 4
- Forks: 52
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# YouTube API Client (youtube_api_client)
Forked (all restructured and improved) from [youtube_api](https://pub.dartlang.org/packages/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](https://flutter.io/platform-plugins/).
[Complete Example Code](https://pub.dartlang.org/packages/youtube_api_client#-example-tab-)
### Example
```dart
static String key = "YOUR_API_KEY";
final youtube = YoutubeApi(_key);
List result = [];
```Search for videos, channels and playlists
```dart
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:
```dart
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:
```dart
SearchOptions(type: ResultType.channel)
```To get Trending videos in your Country-
```dart
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`.
```dart
result = await youtube.searchVideosById(idList);
```[You can find your Country Region Code here](https://www.iso.org/obp/ui/#search/code/)
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 - 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.