[YouTubeFeedExpanderBridge] More reliable channel icons

This commit is contained in:
Phantop 2025-07-20 23:40:24 -04:00
parent 4c0b97d605
commit f915601b4a

View file

@ -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();
} }