commit b078fbde7c9ebd45df177f986850a60157614c9b Author: Gilles Grandou Date: Wed Oct 7 11:11:02 2015 +0200 initial import from https://tt-rss.org/forum/viewtopic.php?f=22&t=3343#p20975 diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..be837cf --- /dev/null +++ b/README.txt @@ -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/ (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/. + +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/ URLs should correctly add the relevant Atom feed subscription. + + + +Stijn Gijsen diff --git a/init.php b/init.php new file mode 100644 index 0000000..9833576 --- /dev/null +++ b/init.php @@ -0,0 +1,28 @@ + 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 = ""; + } + return $contents; + } + + function api_version() { + return 2; + } +} +?>