ftde0 / yt2009

2009 youtube frontend.
Apache License 2.0
176 stars 103 forks source link

Implement `/proxy/` requests for YouTube 1.4.20 support #106

Open gohoski opened 1 month ago

gohoski commented 1 month ago

I have successfully set up yt2009 on my server and tried to patch the latest YouTube APK for Android 1.5/1.6, which is 1.4.20. On the homepage, it makes a POST request to /proxy/ytbt, which isn't currently implemented. In the body, it seems to be merging multiple requests into one.

 POST /proxy/ytbt?ver=3 HTTP/1.1
X-GData-Client: mvapp-android-htc
Content-Length: 720
Connection: Keep-Alive
User-Agent: Android-YouTube/1.1 (bahamas DRC79)

[{'url':'http://****/feeds/api/standardfeeds/most_viewed?format=2&time=today&start-index=1&max-results=3','token':'device-id="z49lc", data="iaq3lunip6zotHC7IKn7aIiKVmI="'},{'url':'http://****/feeds/api/standardfeeds/most_discussed?format=2&time=today&start-index=1&max-results=3','token':'device-id="z49lc", data="Zl2ram9I7k/Bxeh16Iz/mL1eYeM="'},{'url':'http://****/feeds/api/standardfeeds/most_recent?format=2&start-index=1&max-results=3','token':'device-id="z49lc", data="x19ozlUHUvH3Y0uOzxrwxu32Imk="'},{'url':'http://****/feeds/api/standardfeeds/top_rated?format=2&time=today&start-index=1&max-results=3','token':'device-id="z49lc", data="G+Hjv3JWAOiOI6L52+qNLwZsSx4="'},]
HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 150
Date: Wed, 10 Jul 2024 17:38:07 GMT
Connection: keep-alive
Keep-Alive: timeout=5

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /proxy/ytbt</pre>
</body>
</html>

There is also mentions of /proxy/feeds/api/ endpoints in the APK code. Maybe we can further decompile the APK and see what data it is expecting to get.

mrkrabs206 commented 1 month ago

Can i see photo for post request on home?

ftde0 commented 1 month ago

what android version are you using to test this apk? if below 2.3, is it virtualized?

in the meanwhile, in the 1.4.20 apk there seem to be a lot of references to a useProxy, which - if set to false - hints that requests should go directly to gdata with a higher chance of working.

snippet from FeedConnectionManager from 1.4.20:

if (!useProxyServer || !isProxyServerEnabled()) {
  YtLog.m4d(YtLog.Component.HTTP, "getHttpData going directly to server");
  if (url == null) {
    YtLog.m4d(YtLog.Component.HTTP, "getHttpData null url - bailing");
    return null;
  }
  HttpGet get = new HttpGet(url.toString());
  if (partnerAuth != null) {
    get.setHeader("X-GData-Device", partnerAuth);
  }
  httpGet = get;
} 
gohoski commented 1 month ago

what android version are you using to test this apk? if below 2.3, is it virtualized?

1.6. I am testing this on the HTC Tattoo.

mrkrabs206 commented 1 month ago

what android version are you using to test this apk? if below 2.3, is it virtualized?

1.6. I am testing this on the HTC Tattoo.

I need a photo for proof

breakgimme commented 1 month ago

I need a photo for proof

you obviously want it only to post it somewhere else, please stop spamming the repo with this stuff

mrkrabs206 commented 1 month ago

I need a photo for proof

you obviously want it only to post it somewhere else, please stop spamming the repo with this stuff

Im sorry

ftde0 commented 1 month ago

what android version are you using to test this apk? if below 2.3, is it virtualized?

1.6. I am testing this on the HTC Tattoo.

that makes more sense. i'm sorry, but as of now, i don't have any android 1.6 (and below) devices to test old apks with, and the first version of youtube to work on newer android versions is 1.6.21. emulators have proven problematic in such old android versions, as i have tried going that route too.

i can't say that there is no hope, but probably nothing too high priority as long as i don't have a setup to test those apks.