gatsby-remark-embedder
gatsby-remark-embedder copied to clipboard
Add support for YouTube channels, fixes #13
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.
Codecov Report
Merging #141 into master will not change coverage. The diff coverage is
100.00%
.
@@ 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.
@MichaelDeBoey Can you please have a look? That build error does not seem to be coming from my changes.
@acagastya Looking at the Travis log, it looks like you didn't update all snapshots
@MichaelDeBoey Isn't the error from Codepen? Surprisingly, when I do yarn test
, I don't see any error -- what am I missing?
Okay -- found one mistake -- placement of the parenthesis was wrong.
@acagastya Can you tell me how you got the username of all those channels?
I'd love to do some research.
For any YouTube video, click on the name of the uploader.
That that screenshot for example: I would click on Programming with Mosh to get the channel.
@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?
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.
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 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 🙂
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.
I tried to search for more channels -- did not find any channel for whom there wasn't '/user/' URL.
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
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/
.
I've tweeted about it: https://twitter.com/MichaelDeBoey93/status/1313488051654537220 Let's hope it can help us out 🙂
Thanks, for that, @MichaelDeBoey!