Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Filters are not documented anywhere #201

Open
prateekmedia opened this issue Apr 12, 2022 · 1 comment
Open

Search Filters are not documented anywhere #201

prateekmedia opened this issue Apr 12, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@prateekmedia
Copy link
Contributor

Is their any document that shows how to use the search filters, I know they are their but they are not documented.

@prateekmedia prateekmedia added the bug Something isn't working label Apr 12, 2022
@Hexer10
Copy link
Owner

Hexer10 commented Apr 13, 2022

Hi, I've introduced some more tests that should explain how to use them.
Since v1.11.0 you can either use yt.search() or yt.search.search() to search only videos and use a filter, currently you can't use more than one filter, see:

test('Search only videos', () async {
var videos =
await yt!.search.searchContent('Banana', filter: TypeFilters.video);
expect(videos, everyElement(isA<SearchVideo>()));
});
test('Search only channels', () async {
var channels = await yt!.search
.searchContent('PewDiePie', filter: TypeFilters.channel);
expect(channels, everyElement(isA<SearchChannel>()));
});
test('Search only playlists', () async {
var playlists =
await yt!.search.searchContent('Banana', filter: TypeFilters.playlist);
expect(playlists, everyElement(isA<SearchPlaylist>()));
});
test('Search test search filters', () async {
var featureSearch =
await yt!.search.searchContent('hello', filter: FeatureFilters.hd);
expect(featureSearch, isNotEmpty);
var uploadSearch = await yt!.search
.searchContent('hello', filter: UploadDateFilter.lastHour);
expect(uploadSearch, isNotEmpty);
var durationSearch =
await yt!.search.searchContent('hello', filter: DurationFilters.long);
expect(durationSearch, isNotEmpty);
var sortSearch =
await yt!.search.searchContent('hello', filter: SortFilters.viewCount);
expect(sortSearch, isNotEmpty);
});

These are the filters youtube provides: TypeFilters, FeatureFilters, UploadDateFilter, DurationFilters, SortFilters

@Hexer10 Hexer10 added documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants