Add set_basic_feed_info hook to af_comics to fix GoComics title and url.

This commit is contained in:
Rodney Stromlund 2019-03-12 12:16:24 -05:00
parent 63d7705b7f
commit 7daf009a7f
1 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class Af_Comics extends Plugin {
$this->host = $host;
$host->add_hook($host::HOOK_FETCH_FEED, $this);
$host->add_hook($host::HOOK_FEED_BASIC_INFO, $this);
$host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
$host->add_hook($host::HOOK_PREFS_TAB, $this);
@ -166,6 +167,16 @@ class Af_Comics extends Plugin {
return $contents;
}
function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
if ($auth_login || $auth_pass)
return $basic_info;
if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches))
$basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
return $basic_info;
}
function api_version() {
return 2;
}