1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-24 20:07:14 +01:00

fix(YouTube - Spoof client): Fix tracking history on brand accounts (#669)

This commit is contained in:
oSumAtrIX 2024-07-28 15:53:55 +02:00 committed by GitHub
parent 848ed6e878
commit 4ac698fd4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,13 @@ public class SpoofClientPatch {
private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0";
private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING);
/**
* Tracking URL authority to use when spoofing the client to iOS,
* because watch history is not working on brand accounts.
* See <a href="https://github.com/LuanRT/YouTube.js/blob/3153375bcaa6c03afba9da8474e6a9d37471ed29/src/core/mixins/MediaInfo.ts#L152">LuanRT/YouTube.js</a>.
*/
private static final String WWW_TRACKING_URL_AUTHORITY = "www.youtube.com";
/**
* Injection point.
* Blocks /get_watch requests by returning an unreachable URI.
@ -127,6 +134,19 @@ public class SpoofClientPatch {
return original;
}
/**
* Injection point.
* When spoofing the client to iOS, history is not working on brand accounts.
* Replace the tracking URL authority to {@link SpoofClientPatch#WWW_TRACKING_URL_AUTHORITY} to fix this.
*/
public static Uri overrideTrackingUrl(Uri trackingUrl) {
if (SPOOF_CLIENT_ENABLED && SPOOF_CLIENT_TYPE == ClientType.IOS) {
return trackingUrl.buildUpon().authority(WWW_TRACKING_URL_AUTHORITY).build();
}
return trackingUrl;
}
private enum ClientType {
// https://dumps.tadiphone.dev/dumps/oculus/eureka
ANDROID_VR(28, "Quest 3", "1.56.21"),