cosmic-cat-yt / Cosmic-Cat

An UserScript that aims to restore YouTube's 2012 layout.
The Unlicense
29 stars 7 forks source link

Like button and subscribe button doesn't work #18

Open ParkerGit2328 opened 7 months ago

ParkerGit2328 commented 7 months ago

Type

Page Renderer

Page URL

Any youtube video page

Branch

main

Version

Any version

A brief description

The like and subscribe button when clicked likes the video and subscribed doesn't work when refreshed.

Screenshots or videos

Nothing to show

Console output

Nothing to say.

ParkerGit2328 commented 7 months ago

And also many search results show nothing

JoveyMcJupi commented 5 months ago

And also many search results show nothing

I found a solution for this issue!

All you need to do is replace this section at line 6654:

                var results = ytInitialData?.contents?.twoColumnSearchResultsRenderer?.primaryContents?.sectionListRenderer?.contents.find(
                    a => a?.itemSectionRenderer?.contents?.[1]?.videoRenderer
                ).itemSectionRenderer?.contents;

With:

var results = ytInitialData?.contents?.twoColumnSearchResultsRenderer?.primaryContents?.sectionListRenderer?.contents[0]?.itemSectionRenderer?.contents;

It's still pretty buggy occasionally but for the most part this change seems to have fixed it for me!