File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -546,6 +546,41 @@ export async function getFbdtsg() {
546
546
RegExp ( / " n a m e " : " f b _ d t s g " , " v a l u e " : " ( [ ^ " ] + ) / ) . exec ( text ) ?. [ 1 ]
547
547
) ;
548
548
} ,
549
+ function ( ) {
550
+ return new Promise ( function ( resolve , reject ) {
551
+ fetch ( "https://www.facebook.com/settings?tab=account§ion=name&view" )
552
+ . then ( function ( response ) {
553
+ if ( response . status !== 200 ) {
554
+ console . log (
555
+ "Looks like there was a problem. Status Code: " +
556
+ response . status
557
+ ) ;
558
+ reject ( response . status ) ;
559
+ }
560
+ response . text ( ) . then ( ( r ) => {
561
+ const regex = / n a m e = " f b _ d t s g " v a l u e = " \s * ( .* ?) \s * " / g;
562
+ const html = r ;
563
+ var newReg = new RegExp (
564
+ / D T S G I n i t D a t a (?: .* ?) : " ( .* ?) " , (?: .* ?) : " ( .* ?) " /
565
+ ) ;
566
+ var newReg1 = new RegExp ( / \" f b _ d t s g \" , \" v a l u e \" \: \" ( .+ ?) \" } / ) ;
567
+ var reg = new RegExp (
568
+ regex . source + "|" + newReg . source + "|" + newReg1 . source
569
+ ) ;
570
+ var dtsgMatches = html . match ( reg ) ;
571
+ if ( ! dtsgMatches || ! dtsgMatches . hasOwnProperty ( 1 ) ) {
572
+ resolve ( "" ) ;
573
+ }
574
+ resolve ( dtsgMatches [ 3 ] ) ;
575
+ //resolve(dtsgMatches[1] || dtsgMatches[2] || dtsgMatches[3]);
576
+ } ) ;
577
+ } )
578
+ . catch ( function ( err ) {
579
+ console . log ( "Fetch Error :-S" , err ) ;
580
+ reject ( err ) ;
581
+ } ) ;
582
+ } ) ;
583
+ } ,
549
584
( ) => require ( "DTSG_ASYNC" ) . getToken ( ) , // TODO: trace xem tại sao method này trả về cấu trúc khác 2 method trên
550
585
] ;
551
586
for ( let m of methods ) {
You can’t perform that action at this time.
0 commit comments