initial import
from https://tt-rss.org/forum/viewtopic.php?f=22&t=3343#p20975
This commit is contained in:
28
init.php
Normal file
28
init.php
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user