Strange behavior from quantity
rzfzr opened this issue · 2 comments
If I specify any value on quantity, it returns 30 results, if not 60
const channel=new ytcog.Channel(cogSession, {
id: code,
items: 'videos',
quantity: 1,
});
await channel.fetch()
With channel scans, youtube returns up to 30 results (if there are 30+ videos on the channel) per scan. Then they provide a continuation code if you want more. Its like scrolling down through the channel videos in a browser, you get 30 at a time.
ytcog will stop once the number of results received match or exceeds the quantity you specify. If you specify 1, you will get whatever is returned on a single scan which could be up to 30 videos. If you specified 31, you could get up to 60 videos (if there are 60+ videos on the channel).
If you only want 1 video, just reference the first video
await channel.fetch()
let myVideo = channel.videos[0]
A similar thing happens on search results, which give up to 20 results per scan.
Very understandable, thanks a lot!