github-readme-youtube-cards icon indicating copy to clipboard operation
github-readme-youtube-cards copied to clipboard

❓ Question: Filter by video type (shorts vs regular video)

Open Balastrong opened this issue 2 years ago • 2 comments

Description

I'm asking it as a question because I'm not even sure if it's possible from the APIs, but would be possible to filter the shorts?

I'd like to show on my profile only "regular" videos, not shorts, as they don't have a cover image and I don't like too much the final result on my profile.

Balastrong avatar Feb 20 '23 11:02 Balastrong

From what I can tell, it doesn't appear that the XML feed or API have a way of distinguishing between "shorts" and regular videos.

Maybe a filter on the maximum video length could work, but it does complicate things a bit since the duration can only be retrieved through the API so it seemingly would require requesting more than max_videos videos from the YouTube API and filtering down afterwards.

DenverCoder1 avatar Feb 24 '23 08:02 DenverCoder1

@DenverCoder1 I saw this stackoverflow thread and thought it might help.

airscholar avatar Feb 23 '24 02:02 airscholar

Thanks for the link, @airscholar!

I found that the simplest implementation was to support playlist ids. Since YouTube automatically creates shorts playlists and long-form playlists for channels, all you need to do is replace channel_id: ... with playlist_id: ... and for the playlist ID, use your channel ID, but replace "UC" with "UUSH" for shorts only and "UULF" for long only.

For example, if your channel ID is UC-KqnO3ez7vF-kyIQ_22rdA, your shorts playlist id would be UUSH-KqnO3ez7vF-kyIQ_22rdA and your long-form playlist id would be UULF-KqnO3ez7vF-kyIQ_22rdA.

DenverCoder1 avatar Jul 10 '24 09:07 DenverCoder1

I posted a couple of shorts on youtube last week after quite some time and I was wondering again about the state of this issue.

The solution is brilliant and works perfectly, thanks @airscholar and @DenverCoder1! 🚀

Balastrong avatar Jul 10 '24 09:07 Balastrong