1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 05:44:53 +00:00

Grab favicon from site's URL, not the feed's

• Changed Feed to where the favicon is gotten when parsing so the
feed’s site URL is used instead of the feed’s for favicons. Some feeds
don’t have the same domain.
• Fixed a bug in Database.
This commit is contained in:
Dustin Wilson 2017-04-02 21:23:15 -05:00
parent 74ae1106a4
commit 25aeaf4801
2 changed files with 6 additions and 3 deletions

View file

@ -499,7 +499,7 @@ class Database {
try { try {
$feed = new Feed($f['url'], $f['lastmodified'], $f['etag'], $f['username'], $f['password']); $feed = new Feed($f['url'], $f['lastmodified'], $f['etag'], $f['username'], $f['password']);
} catch (Feed\Exception $e) { } catch (Feed\Exception $e) {
$this->db->prepare('UPDATE arsse_feeds SET err_count = err_count + 1, err_msg = "" WHERE id is ?', 'str', 'int')->run( $this->db->prepare('UPDATE arsse_feeds SET err_count = err_count + 1, err_msg = ? WHERE id is ?', 'str', 'int')->run(
$e->getMessage(), $e->getMessage(),
$f['id'] $f['id']
); );

View file

@ -21,8 +21,6 @@ class Feed {
$this->reader = new Reader($config); $this->reader = new Reader($config);
$this->resource = $this->reader->download($url, $lastModified, $etag, $username, $password); $this->resource = $this->reader->download($url, $lastModified, $etag, $username, $password);
// Grab the favicon for the feed; returns an empty string if it cannot find one.
$this->favicon = (new Favicon)->find($url);
} catch (PicoFeedException $e) { } catch (PicoFeedException $e) {
throw new Feed\Exception($url, $e); throw new Feed\Exception($url, $e);
} }
@ -36,6 +34,11 @@ class Feed {
$this->resource->getEncoding() $this->resource->getEncoding()
); );
$feed = $this->parser->execute(); $feed = $this->parser->execute();
// Grab the favicon for the feed; returns an empty string if it cannot find one.
// Some feeds might use a different domain (eg: feedburner), so the site url is
// used instead of the feed's url.
$this->favicon = (new Favicon)->find($siteUrl);
} catch (PicoFeedException $e) { } catch (PicoFeedException $e) {
throw new Feed\Exception($url, $e); throw new Feed\Exception($url, $e);
} }