porjo / freshtube

Display latest videos from your favourite Youtube channels

Home Page:https://porjo.github.io/freshtube/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Youtube handles

porjo opened this issue · comments

YouTube has several ways of identifying a channel: channel ID, legacy username, handle, custom ID (deprecated). See here for more info. Freshtube currently only supports channel ID and legacy username e.g.

youtube.com/channel/UCUZHFZ9jIKrLroW8LcyJEQQ
youtube.com/user/YouTube

It would be nice to also support handles as these are commonly used and it would be convenient if Freshtube could do the conversion back to channel ID.

Unfortunately, the YouTube API has no way to get channel data using a handle, or any way to convert a handle to a channel ID. We could fetch the actual YouTube channel HTML and parse out the channel ID before talking to the Youtube API, however this doesn't work from javascript running in a browser due to youtube.com not returning the CORS header Access-Control-Allow-Origin. Another option is to fetch YouTube channel HTML via a proxy (e.g. web service handler) however that would introduce an undesirable dependency for Freshtube.

I think that's the way, it just has to fetch the channel html page only once and then it can store the channel id locally.

I don't see any other way. Maybe using cloudflare worker as serverless handler be the right choice. I don't know if that would work

Fixed by 1561519