iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.19k stars 1.79k forks source link

add more parameter to look a lot like official youtube client #4851

Open unixfox opened 1 month ago

unixfox commented 1 month ago

Taken from a request done by youtube.js: https://github.com/LuanRT/YouTube.js and I tried to add as much new parameters as possible.

example_yt_request_youtubejs.txt

We are missing:

       "mainAppWebInfo"     => {
          "graftUrl"                  => "https://www.youtube.com",
          "isWebNativeShareAvailable" => true,
          "pwaInstallabilityStatus"   => "PWA_INSTALLABILITY_STATUS_UNKNOWN",
          "webDisplayMode"            => "WEB_DISPLAY_MODE_BROWSER",
        },

inside client_context = { but I can't get my head around the compiler issue:

Done checking player dependencies, now compiling Invidious...
Showing last frame. Use --error-trace for full trace.

In src/invidious/yt_backend/youtube_api.cr:320:33

 320 | "mainAppWebInfo"     => {
                               ^----------
Error: expected argument #2 to 'Hash(String, Int64 | String)#[]=' to be (Int64 | String), not Hash(String, Bool | String)

Overloads are:
 - Hash(K, V)#[]=(key : K, value : V)

Other parameters we are missing:

Remarks:

SamantazFox commented 1 month ago

Other parameters we are missing:

* timeZone: in youtube.js this is dynamically generated from the actual timezone but I don't know if we should or just set a default one
* utcOffsetMinutes: same as above
* remoteHost: we will have to fetch the public IP of the server at the start; not sure >     * "configInfo"."appInstallData": like visitordata, it's an ID

As far as I know, these can be safely omitted. On some browsers with stronger privacy/adblocking features (like Tor), I've often seen these empty.

Some parameters do not make sense in the context of the ANDROID client but I don't think this will do any harm like the size for screenHeightPoints or memoryTotalKbytes

Maybe it's time to split the context logic by client, like NewPipe does?

unixfox commented 1 month ago

Other parameters we are missing:

* timeZone: in youtube.js this is dynamically generated from the actual timezone but I don't know if we should or just set a default one
* utcOffsetMinutes: same as above
* remoteHost: we will have to fetch the public IP of the server at the start; not sure >     * "configInfo"."appInstallData": like visitordata, it's an ID

As far as I know, these can be safely omitted. On some browsers with stronger privacy/adblocking features (like Tor), I've often seen these empty.

ok then we won't set those.

Some parameters do not make sense in the context of the ANDROID client but I don't think this will do any harm like the size for screenHeightPoints or memoryTotalKbytes

Maybe it's time to split the context logic by client, like NewPipe does?

Kinda don't have the time to do it today. I added all the parameters that I found on youtube.js because I have a separate proxy server for yewtu.be that exclusively use youtube.js and this one has never seen any issue about "watch on the latest version".

unixfox commented 1 month ago

@SamantazFox can we merge into master branch?