github-readme-youtube-cards
github-readme-youtube-cards copied to clipboard
❓ Question: Filter by video type (shorts vs regular video)
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.
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 I saw this stackoverflow thread and thought it might help.
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
.
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! 🚀