Skip to content

[YoutubePostsTabsBridge] Rename Community→Posts to fix broken bridge #4606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shaunlebron
Copy link

Fixes #4604. The community tab was renamed to “posts”, causing the bridge to fail.

Context on rename: https://support.google.com/youtube/thread/321825573?hl=en

The Community tab is becoming the Posts tab: To make things clear, we’re giving the “Community” tab a new name: “Posts.” The tab will work just as it does today, just with a new name. Creators can still share updates and announcements via posts and viewers can engage by commenting on those posts like they always have!

I fixed the tab lookup, and renamed the functions, file, and references to match the new “Posts” name.

Tested locally with:

php -S 127.0.0.1:9001

Verified with:
http://localhost:9001/?action=display&bridge=YouTubePostsTabBridge&context=By+channel+ID&channel=UCLYut6IxIvx5PxwUWMXJz8g&format=html

Copy link

github-actions bot commented Jul 7, 2025

Pull request artifacts

Bridge Context Status
YouTubeCommunityTab 1 By channel ID (current) Bridge returned error 0! (20283)
Type: ErrorException
Message: Undefined property: stdClass::$header
YouTubeCommunityTab 2 By username (current) Bridge returned error 0! (20283)
Type: ErrorException
Message: Undefined property: stdClass::$header
YouTubePostsTab 1 By channel ID (pr) ✔️
YouTubePostsTab 2 By username (pr) ✔️

last change: Monday 2025-07-14 01:49:13

@shaunlebron
Copy link
Author

@Mar-Koeh
Copy link
Contributor

Not sure how to fix the errors in the above comment, but they seem to work locally for me:

That's from this line:

$this->feedName = $json->header->c4TabbedHeaderRenderer->title;

There, the result of extractJson is used. This function just does a preg_match for a certain piece of JSON and parses it. If the JSON-parsing fails, then there should be a different error. So it looks like JSON is successfully parsed. I had a look at it in curl. Looks good. However, there c4TabbedHeaderRenderer doesn't occur in the JSON at all. Hence, this line fails. When I looked at it, there were multiple places containing the title:

  • $json->header->pageHeaderRenderer->pageTitle
  • $json->metadata->channelMetadataRenderer->title
  • $json->microformat->microformatDataRenderer->title

The question is why the said line didn't fail when you tried it. I have two theories:

  • YouTube doesn't always output the same JSON. Might be A/B-testing. Might be the guessed device type. Might be based on your location.
  • Your PHP version or config doesn't throw an error but just a warning while using NULL.

You could test this by checking whether your feed has a feedTitle.

Maybe the following line could fix it. It uses the null coalescing operator, which doesn't emit a warning but just attempts the next expression if the previous one would have been NULL.

$this->feedName = $json->header->c4TabbedHeaderRenderer->title ?? $json->header->pageHeaderRenderer->pageTitle ?? $json->metadata->channelMetadataRenderer->title ?? $json->microformat->microformatDataRenderer->title ?? '';

With this line, all currently known locations of the title would be checked and the empty string would be the fallback if none worked.

@shaunlebron
Copy link
Author

Thanks @Mar-Koeh that seemed to work. The remaining errors are from a file that no longer exists after this PR renamed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[YoutubeCommunityTabBridge] broken, can’t find community tab
2 participants