gatsby-remark-embedder icon indicating copy to clipboard operation
gatsby-remark-embedder copied to clipboard

Add support for YouTube channels, fixes #13

Open acagastya opened this issue 4 years ago • 16 comments

What: Added support for YouTube channels of the type https://youtube.com/user/kentdoddsfamily.

Why: Closes #13

How: Per YouTube Docs

Checklist:

  • [x] Documentation
  • [x] Tests
  • [x] Ready to be merged

Caveat

I went through some of the channels:

  • https://www.youtube.com/user/1agastya
  • https://www.youtube.com/user/kentdoddsfamily
  • https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw
  • https://www.youtube.com/user/taylorswift
  • https://www.youtube.com/user/PewDiePie
  • https://www.youtube.com/user/tseries

All but "Official Rick Astley" had their channels of the type "youtube.com/user/" -- I don't know why that one channel has a different format -- it can not be subscribers count because T-Series and Pewdiepie has the maximum count. The docs (linked above) mentions https://www.youtube.com/embed?listType=user_uploads&list=**USERNAME** for this solution.

This is one caveat one needs to be aware of.

acagastya avatar Oct 02 '20 14:10 acagastya

Codecov Report

Merging #141 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #141   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines          220       224    +4     
  Branches        28        29    +1     
=========================================
+ Hits           220       224    +4     
Impacted Files Coverage Δ
src/transformers/YouTube.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba7e462...fb55627. Read the comment docs.

codecov[bot] avatar Oct 02 '20 14:10 codecov[bot]

@MichaelDeBoey Can you please have a look? That build error does not seem to be coming from my changes.

acagastya avatar Oct 02 '20 15:10 acagastya

@acagastya Looking at the Travis log, it looks like you didn't update all snapshots

MichaelDeBoey avatar Oct 03 '20 12:10 MichaelDeBoey

@MichaelDeBoey Isn't the error from Codepen? Surprisingly, when I do yarn test, I don't see any error -- what am I missing?

acagastya avatar Oct 03 '20 12:10 acagastya

Okay -- found one mistake -- placement of the parenthesis was wrong.

acagastya avatar Oct 03 '20 12:10 acagastya

@acagastya Can you tell me how you got the username of all those channels?

I'd love to do some research.

MichaelDeBoey avatar Oct 03 '20 14:10 MichaelDeBoey

For any YouTube video, click on the name of the uploader. 4B3B6D70-00D1-4796-87C1-4878364EDC97 That that screenshot for example: I would click on Programming with Mosh to get the channel.

acagastya avatar Oct 03 '20 14:10 acagastya

@acagastya That way I get https://youtube.com/channel/UCz-BYvuntVRt_VpfR6FKXJw for Kent's channel

And there's no way to support these type of URLs?

MichaelDeBoey avatar Oct 03 '20 14:10 MichaelDeBoey

When I search for Kent C Dodds and click on the first link, it shows https://www.youtube.com/user/kentdoddsfamily-- the same is added in the README for example. Screenshot 2020-10-03 at 21 42 48 I have don't know how the /channel/ links are generated or show up -- because I searched for dozens of channel of different types, but they all have /user/ -- I did not even find it in the documentation for /channel/ -- it talks about user only.

acagastya avatar Oct 03 '20 16:10 acagastya

@acagastya If you watch https://www.youtube.com/watch?v=A4MTOf8hPcE for instance and then click on Kent's username, you'll get redirected to https://youtube.com/channel/UCz-BYvuntVRt_VpfR6FKXJw. It would be awesome to get them to work too 🙂

MichaelDeBoey avatar Oct 03 '20 16:10 MichaelDeBoey

Interestingly, if you click on the profile photo not the name, you will get https://www.youtube.com/user/kentdoddsfamily. Two different URLs but the same page. If you search for "Kent C Dodds" it still shows /user/. The YouTube docs don't even give a mechanism for /channel/ only the user. Can you find those channels which don't have a user link -- if there are hardly such channels then this approach is working perfectly fine. Else we need to wait till Google adds that in the docs.

acagastya avatar Oct 03 '20 17:10 acagastya

I tried to search for more channels -- did not find any channel for whom there wasn't '/user/' URL.

acagastya avatar Oct 04 '20 15:10 acagastya

Adam Wathan: https://youtube.com/channel/UCy1H38XrN7hi7wHSClfXPqQ Apollo GraphQL: https://youtube.com/channel/UC0pEW_GOrMJ23l8QcrGdKSw Camo & Krooked: https://youtube.com/channel/UCxaLJvYDW8XMgrNbdnZ-uMQ React Rally: https://youtube.com/channel/UCXBhQ05nu3L1abBUGeQ0ahw Tailwind Labs: https://youtube.com/channel/UCOe-8z68tgw9ioqVvYM4ddQ

I can go on for some time like this.

It's not the fact that a /user/ is available, it's the fact that when being subscribed to a channel and clicking on the channel in the navbar to the left of just clicking the name instead of the profile pic that you'll get a /channel/ link and I want to support both kinds

MichaelDeBoey avatar Oct 04 '20 15:10 MichaelDeBoey

In that case one needs to find the embed URL pattern -- could you please put out a tweet to any of these channels to provide an embed link for their channel -- so that one can understand how it works? Because those docs only listed how to do for those which have /user/.

acagastya avatar Oct 04 '20 16:10 acagastya

I've tweeted about it: https://twitter.com/MichaelDeBoey93/status/1313488051654537220 Let's hope it can help us out 🙂

MichaelDeBoey avatar Oct 06 '20 14:10 MichaelDeBoey

Thanks, for that, @MichaelDeBoey!

acagastya avatar Oct 06 '20 14:10 acagastya