Youtube icon indicating copy to clipboard operation
Youtube copied to clipboard

How to get the list of channel videos without youtube shorts

Open yasir-naseer opened this issue 2 years ago • 3 comments

Im using Youtube::listChannelVideos() to get the list of channel videos, but it also returns the youtube short, is there a way to filter so we can only get videos?

yasir-naseer avatar Feb 10 '24 11:02 yasir-naseer

@yasir-naseer Did you manage to find a solution ?

alaouy avatar Feb 14 '24 10:02 alaouy

not yet

yasir-naseer avatar Feb 15 '24 06:02 yasir-naseer

Hi, The only way I've found is to filter directly via the description key, if it's empty then it'll be a short. Unfortunately, this isn't 100% reliable.

$videoList = Youtube::listChannelVideos('xxxxxxxxxxxxxx', 40, 'date');

$videosWithoutShort = collect($videoList)->filter(function ($item) {
    return !empty($item->snippet->description);
})

franckitho avatar Jun 28 '24 22:06 franckitho

@yasir-naseer The only reliable way for now to check if a video is a short is to call the url https://www.youtube.com/shorts/ + videoId and check if the status code is 200 ok. Ref: https://stackoverflow.com/a/72197652

alaouy avatar Feb 17 '25 13:02 alaouy