Skip to content

Commit

Permalink
[YouTubeCommunityTabBridge] Improve JSON extraction (#4140)
Browse files Browse the repository at this point in the history
Small change that should make the extraction of JSON from HTML work more
reliably
  • Loading branch information
mightymt authored Jun 24, 2024
1 parent 2a84350 commit adad9d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bridges/YouTubeCommunityTabBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class YouTubeCommunityTabBridge extends BridgeAbstract
private $itemTitle = '';

private $urlRegex = '/youtube\.com\/(channel|user|c)\/([\w]+)\/community/';
private $jsonRegex = '/var ytInitialData = (.*);<\/script>/';
private $jsonRegex = '/var ytInitialData = ([^<]*);<\/script>/';

public function detectParameters($url)
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function collectData()
$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;

Expand Down

0 comments on commit adad9d6

Please sign in to comment.