1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-29 12:50:18 +02:00

[YouTubeCommunityTabBridge] Improve JSON extraction (#4140)

Small change that should make the extraction of JSON from HTML work more
reliably
This commit is contained in:
Thomas
2024-06-24 22:32:03 +02:00
committed by GitHub
parent 2a84350cb2
commit adad9d6405

View File

@@ -32,7 +32,7 @@ class YouTubeCommunityTabBridge extends BridgeAbstract
private $itemTitle = ''; private $itemTitle = '';
private $urlRegex = '/youtube\.com\/(channel|user|c)\/([\w]+)\/community/'; private $urlRegex = '/youtube\.com\/(channel|user|c)\/([\w]+)\/community/';
private $jsonRegex = '/var ytInitialData = (.*);<\/script>/'; private $jsonRegex = '/var ytInitialData = ([^<]*);<\/script>/';
public function detectParameters($url) public function detectParameters($url)
{ {
@@ -70,7 +70,7 @@ class YouTubeCommunityTabBridge extends BridgeAbstract
$html = getSimpleHTMLDOM($this->feedUrl); $html = getSimpleHTMLDOM($this->feedUrl);
} }
$json = $this->extractJson($html->find('body', 0)->innertext); $json = $this->extractJson($html->find('html', 0)->innertext);
$this->feedName = $json->header->c4TabbedHeaderRenderer->title; $this->feedName = $json->header->c4TabbedHeaderRenderer->title;