Skip to content
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

Use the new youtube api for comments #2217

Merged
merged 4 commits into from
Aug 12, 2021
Merged

Conversation

unixfox
Copy link
Member

@unixfox unixfox commented Jun 27, 2021

This PR is related to #1981.

This PR switch the endpoint used for fetching the comments from the old and soon deprecated https://www.youtube.com/comment_service_ajax to the InnerTube API with the endpoint /next.

Issue to fix:

invidious Invalid memory access (signal 11) at address 0xffff811a8158                                                                                                                        │
│ invidious [0x673488] print_backtrace at /usr/lib/crystal/core/exception/call_stack.cr:129:5                                                                                                  │
│ invidious [0x41ac70] __crystal_sigfault_handler at /usr/lib/crystal/core/signal.cr:347:3                                                                                                     │
│ invidious [0xf4e5f4] posix_spawn_file_actions_init at src/process/posix_spawn_file_actions_init.c:7:1                                                                                        │
│ invidious [0xcbd510] ???                                                                                                                                                                     │
│ invidious [0x47f334] -> at /invidious/lib/lsquic/src/lsquic/client.cr:210:11                                                                                                                 │
│ invidious [0x71df28] run at /usr/lib/crystal/core/primitives.cr:255:3                                                                                                                        │
│ invidious [0x41a184] -> at /usr/lib/crystal/core/fiber.cr:92:34                                                                                                                              │
│ invidious [0x0] ???

@unixfox unixfox added the need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something label Jun 27, 2021
@unixfox unixfox requested a review from SamantazFox June 27, 2021 11:53
@SamantazFox
Copy link
Member

While you're at it, can you update the hard-coded client version? latest is 2.20210623

@unixfox
Copy link
Member Author

unixfox commented Jun 27, 2021

While you're at it, can you update the hard-coded client version? latest is 2.20210623

Done ✔️

@cloudrac3r
Copy link
Collaborator

Why do you say comment_service_ajax will be deprecated?

@unixfox
Copy link
Member Author

unixfox commented Jun 29, 2021

Why do you say comment_service_ajax will be deprecated?

The desktop interface of Youtube doesn't use it anymore so that's why I think it is going to soon stop working.

@SamantazFox
Copy link
Member

The desktop interface of Youtube doesn't use it anymore so that's why I think it is going to soon stop working.

Oh, really? The youtube client is still using it in here...
image

@unixfox
Copy link
Member Author

unixfox commented Jun 29, 2021

The desktop interface of Youtube doesn't use it anymore so that's why I think it is going to soon stop working.

Oh, really? The youtube client is still using it in here...
image

Maybe it was an experiment two days ago, unfortunately I didn't record anything, so I can't prove what I said. I really think it was really an experiment because I can't find again the MWEB client name being used on https://m.youtube.com.
m.youtube.com stopped using the innertube API too.

@coletdjnz
Copy link

coletdjnz commented Jun 29, 2021

We got a report about this too (yt-dlp/yt-dlp#438) - it seems like they are A/B testing it with the new API. For me it's still using the old API, but I'm guessing they'll slowly roll some form of this out in the coming months. The old endpoint probably won't go away for a while.

@unixfox unixfox force-pushed the comment-mobile branch 3 times, most recently from db589c9 to 33fd1d4 Compare June 30, 2021 10:50
@Perflyst
Copy link
Contributor

Perflyst commented Jul 1, 2021

In testing on one of my backends

@SamantazFox SamantazFox added in-testing This feature has been deployed and is being tested and removed need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something labels Jul 2, 2021
@unixfox
Copy link
Member Author

unixfox commented Jul 7, 2021

Broken comments on https://yewtu.be/watch?v=Lsuob8Uug50

@coletdjnz
Copy link

coletdjnz commented Jul 8, 2021

FYI it appears that YouTube is deploying this new API change to desktop web now, and they have changed the response json structure too.

@iv-org iv-org deleted a comment from Akczht Jul 8, 2021
@putara
Copy link

putara commented Jul 8, 2021

I’ve been running my instance with #2220 for a week now.
The “View replies” link doesn’t always work and I have to click the link several times to make it work.

For example, right now I can’t open the “View 3 replies” link in JvJVvP5JIgs and just got this:
[info] 500 GET /api/v1/comments/JvJVvP5JIgs?format=html&hl=en-US&thin_mode=false&continuation=EkMSC0p2SlZ2UDVKSWdzyAEA4AEBogINKP___________wFAAMICHQgEGhdodHRwczovL3d3dy55b3V0dWJlLmNvbSIAGAYyTRpLEhpVZ3dRU0plb3BvTEFJY2pjanFsNEFhQUJBZyICCAAqGFVDTExyZ3Y0QmhwbGpJWlBpU0wzUHhMdzILSnZKVnZQNUpJZ3NAAUgK&action=action_get_comment_replies 270.22ms

Also it sometimes crashes the instance:

invidious_1  | Invalid memory access (signal 11) at address 0xffff9f6bd0f8
invidious_1  | [0x6a90f4] ???
invidious_1  | [0x41acd4] ???
invidious_1  | [0xfaa2f4] ???
invidious_1  | [0xd19230] ???
invidious_1  | [0x47f2d0] ???
invidious_1  | [0x753950] ???
invidious_1  | [0x41a1e8] ???
invidious_1  | [0x0] ???

@unixfox
Copy link
Member Author

unixfox commented Jul 15, 2021

I’ve been running my instance with #2220 for a week now.
The “View replies” link doesn’t always work and I have to click the link several times to make it work.

For example, right now I can’t open the “View 3 replies” link in JvJVvP5JIgs and just got this:
[info] 500 GET /api/v1/comments/JvJVvP5JIgs?format=html&hl=en-US&thin_mode=false&continuation=EkMSC0p2SlZ2UDVKSWdzyAEA4AEBogINKP___________wFAAMICHQgEGhdodHRwczovL3d3dy55b3V0dWJlLmNvbSIAGAYyTRpLEhpVZ3dRU0plb3BvTEFJY2pjanFsNEFhQUJBZyICCAAqGFVDTExyZ3Y0QmhwbGpJWlBpU0wzUHhMdzILSnZKVnZQNUpJZ3NAAUgK&action=action_get_comment_replies 270.22ms

Also it sometimes crashes the instance:

invidious_1  | Invalid memory access (signal 11) at address 0xffff9f6bd0f8
invidious_1  | [0x6a90f4] ???
invidious_1  | [0x41acd4] ???
invidious_1  | [0xfaa2f4] ???
invidious_1  | [0xd19230] ???
invidious_1  | [0x47f2d0] ???
invidious_1  | [0x753950] ???
invidious_1  | [0x41a1e8] ???
invidious_1  | [0x0] ???

Should now be fixed.

@SamantazFox Could you take a look at the new code? Not sure if I wrote it properly.

@SamantazFox
Copy link
Member

@SamantazFox Could you take a look at the new code? Not sure if I wrote it properly.

I'm not sure what you tried to achieve here: be22e2c#diff-c3b1698911da42ad59caee99b5c324448dfe7c8a79ca6b0995c2e07d3ee8ebe7R86-R99

@unixfox
Copy link
Member Author

unixfox commented Jul 16, 2021

@SamantazFox Could you take a look at the new code? Not sure if I wrote it properly.

I'm not sure what you tried to achieve here: be22e2c#diff-c3b1698911da42ad59caee99b5c324448dfe7c8a79ca6b0995c2e07d3ee8ebe7R86-R99

Youtube is A/B testing a new format for the comments. This format is derived from the ANDROID client format.
We must support the old format and the new one at the same time because we don't know which one youtube is going to serve.

@SamantazFox
Copy link
Member

Youtube is A/B testing a new format for the comments. This format is derived from the ANDROID client format.
We must support the old format and the new one at the same time because we don't know which one youtube is going to serve.

I got that, but what about the for loop that overrides the different variables each time?

@SamantazFox
Copy link
Member

SamantazFox commented Jul 28, 2021

in testing on https://test.invidious.io, along with #2277 and #2220

NB: I had to do some minor changes to make it work

@TheFrenchGhosty TheFrenchGhosty marked this pull request as ready for review August 12, 2021 17:11
@TheFrenchGhosty TheFrenchGhosty removed the in-testing This feature has been deployed and is being tested label Aug 12, 2021
@SamantazFox SamantazFox merged commit 88c5e3b into iv-org:master Aug 12, 2021
@SamantazFox
Copy link
Member

Merging as-is, even if in some rare cases comments don't show up. Youtube has moved entirely to that new endpoint, so comments were broken.

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

Successfully merging this pull request may close these issues.

7 participants