@@ -8,8 +8,8 @@ use log::{error, info, trace, warn};
88use percent_encoding:: { percent_encode, CONTROLS } ;
99use serde_json:: Value ;
1010use wreq:: redirect:: Policy ;
11- use wreq:: { Client as WreqClient , EmulationFactory } ;
12- use wreq_util:: { Emulation , EmulationOS , EmulationOption } ;
11+ use wreq:: Client as WreqClient ;
12+ use wreq_util:: Emulation ;
1313
1414use std:: sync:: atomic:: Ordering ;
1515use std:: sync:: atomic:: { AtomicBool , AtomicU16 } ;
@@ -61,22 +61,15 @@ const URL_PAIRS: [(&str, &str); 2] = [
6161] ;
6262
6363pub fn build_client ( ) -> WreqClient {
64- // Use a diverse set of browser profiles so different instances (and restarts)
65- // produce different TLS/HTTP2 fingerprints, making bulk blocking harder .
64+ // Use OkHttp 4.x profiles to match Reddit's Android app TLS fingerprint,
65+ // keeping it consistent with the spoofed Android headers in MobileSpoofAuth .
6666 let emulations = [
67- Emulation :: Chrome135 ,
68- Emulation :: Chrome136 ,
69- Emulation :: Chrome137 ,
70- Emulation :: Firefox135 ,
71- Emulation :: Firefox136 ,
67+ Emulation :: OkHttp4_9 ,
68+ Emulation :: OkHttp4_10 ,
69+ Emulation :: OkHttp4_12 ,
7270 ] ;
73- let emulation_os = [ EmulationOS :: Android , EmulationOS :: Windows , EmulationOS :: Linux ] ;
7471
75- let emulation = EmulationOption :: builder ( )
76- . emulation ( * fastrand:: choice ( emulations. iter ( ) ) . unwrap ( ) )
77- . emulation_os ( * fastrand:: choice ( emulation_os. iter ( ) ) . unwrap ( ) )
78- . build ( )
79- . emulation ( ) ;
72+ let emulation = * fastrand:: choice ( emulations. iter ( ) ) . unwrap ( ) ;
8073
8174 info ! ( "Building wreq client with emulation {:?}" , emulation) ;
8275
0 commit comments