Output array include type: "shelf" when using getFilters with get('Type').get('Video')
wanaimnn opened this issue · 2 comments
wanaimnn commented
I thought the get('Type').get('Video')
method is only filtering type: "video"
only
import ytsr from 'ytsr';
const query = 'vevo'; // using query "vevo" as example
const filters = await ytsr.getFilters(query);
const videoFilter = filters.get('Type').get('Video');
const options = {
limit: 20,
}
const searchResults = await ytsr(videoFilter.url, options);
console.log(searchResults);
The output in arrays include type: "shelf"
if you search it
{
"type": "shelf",
"title": "Shorts",
"items": []
}
Is it possible to only getting type:"video"
only and exclude the type: "shelf"
?
TimeForANinja commented
the filters.get('Type').get('Video');
is altering the query send to youtube
if youtube decides to serve you videos in a shelf the library does the same
what you can obviously do is do the filtering yourself
or flatten all shelfs (or even all elements with a items
key) into a single list of videos
jnomikos commented
I ran into the same issue. I will do some brute force filtering rather than relying on YouTube