← Back to context

Comment by dang

14 hours ago

I've been wanting to make that work for a long time! Assuming I understand you correctly: for HN to segment youtube domains so they show as youtube/channel the way github/username, twitter/username, etc., do.

I think I got stuck on needing some account to access the API that will tell you the channel name.

I thought they meant turning that page into a YouTube-like view (being able to filter by channel would also be very cool, though), I was going to do something similar in my own HN extension, but after trying an initial lazy embedding approach [1], asking for declarativeNetRequestWithHostAccess to be able to bypass HN's Content-Security-Policy feels icky.

Having https://i.ytimg.com in img-src (for thumbnails) and https://www.youtube-nocookie.com in frame-src (for embeds) would be nice :)

Edit: you can use YouTube's oembed endpoint to get channel details for a video, e.g.:

https://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube...

[1] https://imgur.com/a/hacker-newstube-g1BQ7lf