pipes icon indicating copy to clipboard operation
pipes copied to clipboard

Automatically parse Youtube URLs to get channel or user's feed

Open anewuser opened this issue 8 years ago • 16 comments

A useful idea from Inoreader is to convert Youtube URLs in feed blocks to their appropriate feed URLs automatically on your server side, since Youtube doesn't embed the addresses in its pages, and people would need to look it up manually every time they create a new pipe.

Examples of URLs formats that may be entered in a feed block, and their corresponding feeds:

Channel:

https://www.youtube.com/channel/EXAMPLE/videos (featured|videos|about|etc.) Actual feed: https://www.youtube.com/feeds/videos.xml?channel_id=EXAMPLE

User page:

https://www.youtube.com/user/EXAMPLE/videos (featured|videos|about|etc.) Actual feed: https://www.youtube.com/feeds/videos.xml?user=EXAMPLE

Playlist:

https://www.youtube.com/playlist?list=EXAMPLE / https://www.youtube.com/watch?v=FOO&list=EXAMPLE Actual feed: https://www.youtube.com/feeds/videos.xml?playlist_id=EXAMPLE

anewuser avatar Jul 19 '17 19:07 anewuser

That's even a complete list of scenarios, isn't it? Playlists, channels, user page feeds.

onli avatar Jul 24 '17 16:07 onli

Well, hopefully your users will be "computer literate" enough to enter URLs that include the channel or user ID (which can be manipulated with regexes to get the feeds, like in my examples), so those are all scenarios. :)

If someone is inclined to enter a direct video URL, you'd have to make use of Youtube APIs to get the feed, but I doubt that they'd be interested in your service in first place.

anewuser avatar Jul 26 '17 01:07 anewuser

Okay then. Thanks, this is a great idea. I got it implemented in the current dev version, it will go live with the next update.

onli avatar Jul 26 '17 10:07 onli

This feature is also online now. Could you give me feedback whether this works as expected for you?

onli avatar Aug 01 '17 15:08 onli

It worked with the URLs I inserted to test it. I'll report it if I run through any problems.

Out of the other changes, I think that "My Pipes" should have a consistent position in the menu (it's visible on the frontpage but hidden once you open a pipe), and the settings button looks like a "turn off" icon, so my first guess was that it was a "logout" button.

anewuser avatar Aug 03 '17 01:08 anewuser

Super, thanks.

the settings button looks like a "turn off" icon, so my first guess was that it was a "logout" button

Oh, which button do you mean exactly?

I think that "My Pipes" should have a consistent position in the menu (it's visible on the frontpage but hidden once you open a pipe)

Yeah, I'm not sure about that. On the one hand you are right, that should be consistent. On the other it does not make sense to have a profile avatar and menu on the landing page. I'm conflicted there, thanks for the feedback though!

onli avatar Aug 03 '17 10:08 onli

aa6565858d3a61987e46447847e700c2

anewuser avatar Aug 09 '17 15:08 anewuser

If you see that image at the top right, then that should be there because it is your gravatar image. I remember that one being used by Wordpress, maybe they set it as default in the past? Not sure though.

But I do indeed think that menu is a bit too hidden, but I'm not sure how to fix that.

onli avatar Aug 10 '17 09:08 onli

It must still be the default then (at least for the API you use), because the email address I'm using with your service is new and I haven't set a Gravatar for it.

anewuser avatar Aug 10 '17 11:08 anewuser

@onli can you please take a look at this? The second feed (a Youtube playlist) is causing errors: -edited-

anewuser avatar Jun 22 '19 15:06 anewuser

@anewuser Sure. It looks like there was an additional situation where the system could not find the feed link. I added a workaround and it seems to work now. Could you test again?

onli avatar Jun 23 '19 08:06 onli

Thank you!

anewuser avatar Jun 23 '19 22:06 anewuser

@onli

URLs that start with https://www.youtube.com/c/NoCopyrightSounds should redirect to https://www.youtube.com/feeds/videos.xml?channel_id=UC_aEa8K-EOJ3D6gOs7HcyNg

anewuser avatar Oct 31 '20 23:10 anewuser

I tried to get around parsing the youtube page by instead redirecting to https://www.youtube.com/feeds/videos.xml?user=NoCopyrightSounds - that works equally well here, right?

onli avatar Nov 13 '20 17:11 onli

That depends on whether it started off as a regular user or a brand account. The previous example is actually a user account, because https://www.youtube.com/user/NoCopyrightSounds/ works too.

Here's an example of a brand account: https://www.youtube.com/c/dwpolski/videos / https://www.youtube.com/dwpolski/videos (the /c/ part seems to be optional). These links don't work on Pipes currently.

For these cases (Youtube links that don't include /user/, /channel/, or /playlist?), I think that you'd have to get the canonical channel ID from the source code (<link rel="canonical" href="https://www.youtube.com/channel/UCgLYY5Ghbnw-e1ItZg8Y82g">) and then add it to https://www.youtube.com/feeds/videos.xml?channel_id=.

anewuser avatar Nov 17 '20 22:11 anewuser

Alright, great to know!

Let's start with the canoncal url parsing when the url contains /c/. I added that in https://github.com/pipes-digital/pipes/commit/914841c1a23b5a0966e3b5f4455f368f1e693dea

https://www.youtube.com/dwpolski/videos (the /c/ part seems to be optional). These links don't work on Pipes currently.

For that one in general we do not detect youtube's /videos page yet. But that could be added I think. And right, we could do that in general for all channel pages, with the canoncial url detection.

onli avatar Nov 22 '20 10:11 onli