Gilles Grandou 7 years ago
commit b078fbde7c

@ -0,0 +1,20 @@
When attempting to add the Atom feeds for YouTube Channels, sometimes TT-RSS will be unable to find the feed.
I've been running into this issue since YouTube disabled v2 of their data API, and I decided to try my hand at writing a plugin to fix it.
The problem is that some channel pages don't seem to link to their Atom feeds, yet others do. I do not know what causes this.
The result of this problem is that some RSS feeds for YouTube channels can be added to TT-RSS simply by pasting the YouTube channel URL in the Add Subscription box, yet for other channels this will result in TT-RSS (correctly) stating there are no feeds on the page.
The plugin I ended up making is a bit of a hack: Whenever you try to subscribe to a URL like this: youtube.com/channel/<channel id> (e.g. https://www.youtube.com/channel/UCX20tFFXihWdnuOtEyag5EA) the plugin will translate this into a subscription for the Atom feed. YouTube uses these URLs when you click the channel name below a YouTube video.
It does not work for URLs like youtube.com/user/<nickname>.
Installation instructions
-------------------------
Extract the youtube_subscription directory from the ZIP-file into your plugins or plugins.local directory of your TT-RSS installation.
Then enable the youtube_subscription plugin in your TT-RSS settings.
Now subscribing to youtube.com/channel/<channel id> URLs should correctly add the relevant Atom feed subscription.
Stijn Gijsen <gonewacko@gonewacko.com>

@ -0,0 +1,28 @@
<?php
class Youtube_Subscription extends Plugin {
private $host;
function about() {
return array(1.0,
"Allows subscribing to YouTube Channel Atom feeds via youtube.com/channel/<channel ID> URLs",
"GoneWacko");
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
}
function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
if (preg_match("/youtube\.com\/channel\/(UC.*)$/", $url, $matches) === 1) {
$channel_id = $matches[1];
$contents = "<html><head><link rel=\"alternate\" type=\"application/atom+xml\" href=\"https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id\" /></head><body></body></html>";
}
return $contents;
}
function api_version() {
return 2;
}
}
?>
Loading…
Cancel
Save