-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
replicate headers and params made by yt apps #3290
Conversation
return if request.resource.starts_with? "/sorry/index" | ||
request.headers["x-youtube-client-name"] ||= "1" | ||
request.headers["x-youtube-client-version"] ||= "2.20200609" | ||
# Preserve original cookies and add new YT consent cookie for EU servers | ||
request.headers["cookie"] = "#{request.headers["cookie"]?}; CONSENT=YES+" | ||
request.headers["Cookie"] = "#{request.headers["cookie"]?}; CONSENT=YES+" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When did we switch to "YES+" here!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhhh, seems that we've always been using that: 739f610
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a long time, that's why I did create this PR back in the days: #2207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically CONSENT=YES+
is only needed for the HTML pages. Like when fetching the captions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though it was only required for the "mixes" nowadays. I'm working on moving the captions to innertube, anyway...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could only send the CONSENT+YES cookie if we detect that the path doesn't start with /youtubei
.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could even restrict more so that it's only sent for /mixes
(or the associated innertube endpoint for mixes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamantazFox without the CONSENT=YES+
cookie EU IP addresses get redirected to the GDPR consent page, so it is definitely still required. AFAIK that also applies to requests to the InnerTube API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't apply to InnerTube API requests, you can test it by yourself, it works fine without this cookie.
It only applies to HTML pages, the InnerTube API is not an HTML page.
@SamantazFox I have replicated even more the requests made by a yt app, feel free to review again :D |
Just in case: I wanted to add even more sppofing https://github.com/SamantazFox/invidious/tree/yt-api-improvements |
Feel free to discontinue my PR in favor of your work. Do note about the useragents (IOS and android), devicemaker, devicemodel, ios osversion and EDIT: Just looked at the code and it's a very good idea to split things even more :). Good work. |
@SamantazFox While we wait for you to finish your improvements, can we at least add the user agent required to solve the issue in #3230? |
@unixfox yup, sure. Sorry for the delay :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs testing, though.
We won't use your code from https://github.com/SamantazFox/invidious/tree/yt-api-improvements? |
Yes, but later. I don't have much time to work on it atm, so your solution will do in the meantime :) |
Deployed on https://test.invidious.io |
After a few days of testing on yewtu.be. Everything seems fine. Good to merge @SamantazFox? |
@unixfox yep, done :) |
This PR tries to replicate all the necessary headers and parameters made by YouTube apps in order to look more like a real YouTube app.
This avoids being classified as "an outdated YouTube app" by YouTube servers like in #3230.
Closes #3230