11package io.github.chsbuffer.revancedxposed.youtube.video.playerresponse
22
3+ import io.github.chsbuffer.revancedxposed.BuildConfig
4+ import io.github.chsbuffer.revancedxposed.SkipTest
5+ import io.github.chsbuffer.revancedxposed.findClassDirect
36import io.github.chsbuffer.revancedxposed.findMethodDirect
47
5- val playerParameterBuilderFingerprint = findMethodDirect {
8+ // no longer works since 20.46.33
9+ @get:SkipTest
10+ val oldPlayerParameterBuilderFingerprint = findMethodDirect {
611 findMethod {
712 matcher {
813 usingStrings(" psns" , " psnr" , " psps" , " pspe" )
914 }
1015 }.single {
1116 it.paramTypeNames.contains(" java.lang.String" )
1217 }
18+ }
19+
20+ val playerParameterBuilderClass = findClassDirect {
21+ findMethod {
22+ matcher {
23+ usingEqStrings(
24+ " ps_s" ,
25+ " ps_r" ,
26+ " PLAYER_REQUEST_WAS_AUTOPLAY" ,
27+ " PLAYER_REQUEST_WAS_AUTONAV" ,
28+ " PLAYER_REQUEST_CLICK_TRACKING" ,
29+ " " ,
30+ " PLAYER_RESPONSE_SOURCE_KEY"
31+ )
32+ }
33+ }.single().declaredClass!! //
34+ .methods.first { it.isConstructor && it.paramCount >= 3 } //
35+ .paramTypes[2 ]
36+ }
37+
38+ val playerParameterBuilderFingerprint = findMethodDirect {
39+ playerParameterBuilderClass().findMethod {
40+ matcher {
41+ // java.lang.String,
42+ // byte[],
43+ // java.lang.String,
44+ // java.lang.String,
45+ // int,
46+ // int / [boolean, int, XXX]
47+ // java.util.Set,
48+ // java.lang.String,
49+ // java.lang.String,
50+ // XXX
51+ // boolean, // (IsShortAndOpeningOrPlaying)
52+ // boolean,
53+ // boolean,
54+ // boolean / XXX.time.Duration
55+ paramCount(min = 11 )
56+ }
57+ }.single()
58+ // Unit Test
59+ .also {
60+ if (BuildConfig .DEBUG ) {
61+ val old = runCatching { oldPlayerParameterBuilderFingerprint() }.getOrNull()
62+ if (old != null && it != old) throw Exception (" Old: $old \n New: $it " )
63+ }
64+ }
1365}
0 commit comments