mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 08:07:33 +02:00
[YouTubeFeedExpanderBridge] More reliable channel icons (#4622)
This commit is contained in:
@@ -38,12 +38,7 @@ class YouTubeFeedExpanderBridge extends FeedExpander
|
|||||||
{
|
{
|
||||||
if ($this->getInput('channel') != null) {
|
if ($this->getInput('channel') != null) {
|
||||||
$html = getSimpleHTMLDOMCached($this->getURI());
|
$html = getSimpleHTMLDOMCached($this->getURI());
|
||||||
$scriptRegex = '/var ytInitialData = (.*?);<\/script>/';
|
return $html->find('[itemprop="thumbnailUrl"]', 0)->href;
|
||||||
$result = preg_match($scriptRegex, $html, $matches);
|
|
||||||
if (isset($matches[1])) {
|
|
||||||
$json = json_decode($matches[1]);
|
|
||||||
return $json->metadata->channelMetadataRenderer->avatar->thumbnails[0]->url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return parent::getIcon();
|
return parent::getIcon();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user