Skip to content

Commit

Permalink
[PriviblurBridge] Fix invalid favicon, use either Tumblr or blog icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Phantop committed Nov 15, 2024
1 parent 6c86e2c commit 8ac59aa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bridges/PriviblurBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PriviblurBridge extends BridgeAbstract
];

private $title;
private $favicon = 'https://www.tumblr.com/favicon.ico';

public function collectData()
{
Expand All @@ -25,6 +26,11 @@ public function collectData()
$html = defaultLinkTo($html, $url);
$this->title = $html->find('head title', 0)->innertext;

if ($html->find('#blog-header img.avatar', 0)) {
$icon = $html->find('#blog-header img.avatar', 0)->src;
$this->favicon = str_replace('pnj', 'png', $icon);
}

$elements = $html->find('.post');
foreach ($elements as $element) {
$item = [];
Expand Down Expand Up @@ -64,6 +70,11 @@ public function getName()

public function getURI()
{
return $this->getInput('url') ? $this->getInput('url') : parent::getURI();
return $this->getInput('url') ?? parent::getURI();
}

public function getIcon()
{
return $this->favicon;
}
}

0 comments on commit 8ac59aa

Please sign in to comment.