11/*
2- 更新时间: 2021-02-12 16 :00
2+ 更新时间: 2021-02-13 20 :00
33赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢
44本脚本仅适用于中青看点极速版领取青豆
55食用说明请查看本仓库目录Taskconf/youth/readme.md
@@ -15,6 +15,7 @@ const withdrawcash = $.getdata('zqcash')||30 //提现金额
1515let withdrawUrl = $ . getdata ( 'cashurl_zq' )
1616let withdrawBody = $ . getdata ( 'cashbody_zq' )
1717let rotaryscore = 0 , doublerotary = 0 ;
18+
1819let cookieArr = [ ] , cookie = '' ,
1920 readArr = [ ] , articlebodyVal = '' ,
2021 timeArr = [ ] , timebodyVal = '' ,
@@ -107,7 +108,6 @@ if (isGetCookie = typeof $request !== 'undefined') {
107108 await gameVideo ( ) ;
108109 await readArticle ( ) ;
109110 await Articlered ( ) ;
110- await readTime ( ) ;
111111for ( k = 0 ; k < 5 ; k ++ ) {
112112 await $ . wait ( 1000 ) ;
113113 await rotary ( ) ;
@@ -141,7 +141,7 @@ $.log(`转盘双倍: +${doublerotary}青豆 剩余${rotaryres.data.doubleNum}次
141141 . catch ( ( e ) => $ . logErr ( e ) )
142142 . finally ( ( ) => $ . done ( ) )
143143
144- function kdHost ( api , header , body ) {
144+ function kdHost ( api , body ) {
145145 return {
146146 url : 'https://kd.youth.cn/' + api + `&${ myuid } ` ,
147147 headers :{
@@ -171,14 +171,17 @@ function TaskCenter() {
171171 await getAction ( dailys . reward_action )
172172 } else if ( dailys . status == "2" && dailys . action != "" ) {
173173 $ . log ( dailys . title + "," + dailys . but + ",已领取青豆" + dailys . score )
174+ detail += `【${ dailys . title } 】✅ ${ dailys . score } 青豆\n`
174175 } ;
175176 if ( dailys . title == "打卡赚钱" && ONCard == "true" ) {
176- if ( dailys . status == "0" ) {
177- await punchCard ( )
178- } else if ( dailys . status == "1" && $ . time ( "HH" ) == "05" || $ . time ( "HH" ) == "13" ) {
179- await endCard ( )
180- }
177+ //$.log(JSON.stringify(dailys))
178+ if ( dailys . status == "0" && $ . time ( "HH" ) > "17" ) {
179+ await CardStatus ( )
180+ }
181181 }
182+ if ( dailys . id == "7" && dailys . status == "0" ) {
183+ await readTime ( ) ;
184+ }
182185 if ( dailys . id == "10" && dailys . status == "0" ) {
183186 $ . log ( dailys . title + "未完成,去做任务" ) ;
184187 for ( x = 0 ; x < 5 ; x ++ ) {
@@ -290,6 +293,25 @@ function withDraw() {
290293}
291294
292295
296+
297+ function CardStatus ( ) {
298+ return new Promise ( ( resolve , reject ) => {
299+ $ . get ( kdHost ( 'WebApi/PunchCard/getMainData?&' + cookie ) , async ( error , response , data ) => {
300+ punchcard = JSON . parse ( data ) ;
301+ if ( punchcard . code == 1 && punchcard . data . user . status == 0 ) {
302+ await punchCard ( )
303+ } else if ( punchcard . code == 1 && punchcard . data . user . status == 1 ) {
304+ $ . log ( "每日打卡已报名,请设置早晨5点运行打卡" )
305+ detail += `【打卡报名】🔔 已报名 待明早5点打卡\n`
306+ if ( $ . time ( "HH" ) == "05" ) {
307+ await endCard ( )
308+ }
309+ }
310+ resolve ( ) ;
311+ } )
312+ } )
313+ }
314+
293315function punchCard ( ) {
294316 return new Promise ( ( resolve , reject ) => {
295317 $ . post ( kdHost ( 'WebApi/PunchCard/signUp' ) , ( error , response , data ) => {
@@ -299,7 +321,7 @@ function punchCard() {
299321 $ . log ( "每日报名打卡成功,报名时间:" + `${ $ . time ( 'MM-dd HH:mm' ) } ` )
300322 }
301323 else {
302- // detail += `【打卡报名】${punchcardstart.msg}\n`
324+ detail += `【打卡报名】🔔 ${ punchcardstart . msg } \n`
303325 // $.log(punchcardstart.msg)
304326 }
305327 resolve ( ) ;
@@ -309,24 +331,24 @@ function punchCard() {
309331
310332//结束打卡
311333function endCard ( ) {
312- return new Promise ( ( resolve , reject ) => {
313- setTimeout ( ( ) => {
314- $ . post ( kdHost ( 'WebApi/PunchCard/doCard?' ) , async ( error , response , data ) => {
315- punchcardend = JSON . parse ( data )
316- if ( punchcardend . code == 1 ) {
317- detail += `【早起打卡】${ punchcardend . data . card_time } ${ punchcardend . msg } ✅\n` ;
318- $ . log ( "早起打卡成功,打卡时间:" + `${ punchcardend . data . card_time } ` ) ;
319- await $ . wait ( 1000 ) ;
320- await Cardshare ( ) ;
321- } else if ( punchcardend . code == 0 ) {
322- // TODO .不在打卡时间范围内
323- // detail += `【早起打卡】${punchcardend.msg}\n`
324- // $.log("不在打卡时间范围内")
325- }
326- resolve ( )
327- } )
328- } , s )
329- } )
334+ return new Promise ( ( resolve , reject ) => {
335+ setTimeout ( ( ) => {
336+ $ . post ( kdHost ( 'WebApi/PunchCard/doCard?' ) , async ( error , response , data ) => {
337+ punchcardend = JSON . parse ( data ) ;
338+ if ( punchcardend . code == 1 ) {
339+ detail += `【早起打卡】${ punchcardend . data . card_time } ${ punchcardend . msg } ✅\n` ;
340+ $ . log ( "早起打卡成功,打卡时间:" + `${ punchcardend . data . card_time } ` ) ;
341+ await $ . wait ( 1000 ) ;
342+ await Cardshare ( ) ;
343+ } else if ( punchcardend . code == 0 ) {
344+ // TODO .不在打卡时间范围内
345+ detail += `【早起打卡】${ punchcardend . msg } \n` ;
346+ // $.log("不在打卡时间范围内")
347+ }
348+ resolve ( )
349+ } )
350+ } , s )
351+ } )
330352}
331353//打卡分享
332354function Cardshare ( ) {
@@ -432,16 +454,16 @@ function friendSign(uid) {
432454
433455//看视频奖励
434456function getAdVideo ( ) {
435- return new Promise ( ( resolve , reject ) => {
436- $ . post ( kdHost ( 'taskCenter/getAdVideoReward' , "" , 'type=taskCenter' ) , ( error , resp , data ) => {
437- let adVideores = JSON . parse ( data ) ;
438- if ( adVideores . status == 1 ) {
439- detail += `【观看视频】+${ adVideores . score } 个青豆\n`
440- $ . log ( "观看视频广告" + adVideores . num + "次 +" + adVideores . score + "青豆" )
441- }
442- resolve ( )
443- } )
457+ return new Promise ( ( resolve , reject ) => {
458+ $ . post ( kdHost ( 'taskCenter/getAdVideoReward' , 'type=taskCenter' ) , ( error , resp , data ) => {
459+ let adVideores = JSON . parse ( data ) ;
460+ if ( adVideores . status == 1 ) {
461+ detail += `【观看视频】 + ${ adVideores . score } 个青豆\n` ;
462+ $ . log ( "观看视频广告" + adVideores . num + "次 +" + adVideores . score + "青豆" )
463+ }
464+ resolve ( )
444465 } )
466+ } )
445467}
446468function recordAdVideo ( acttype ) {
447469 return new Promise ( ( resolve , reject ) => {
@@ -566,18 +588,9 @@ function readTime() {
566588//转盘任务
567589function rotary ( ) {
568590 return new Promise ( ( resolve , reject ) => {
569- const time = new Date ( ) . getTime ( ) ;
570- const url = {
571- url : `https://kd.youth.cn/WebApi/RotaryTable/turnRotary?_=${ time } ` ,
572- headers : {
573- 'Referer' : 'https://kd.youth.cn/html/rotaryTable/index.html?' + cookie
574- } ,
575- body : cookie ,
576- }
577- $ . post ( url , async ( error , resp , data ) => {
591+ $ . post ( kdHost ( `WebApi/RotaryTable/turnRotary?_=${ Date . now ( ) } &` , cookie ) , async ( error , resp , data ) => {
578592 try {
579593 rotaryres = JSON . parse ( data ) ;
580- //$.log(formatJson(data));
581594 if ( rotaryres . status == 1 ) {
582595 $ . log ( "进行" + Number ( 100 - rotaryres . data . remainTurn ) + "次转盘,获得" + rotaryres . data . score + "青豆" )
583596 if ( rotaryres . data . score != 0 && rotaryres . data . doubleNum != 0 ) {
@@ -613,15 +626,7 @@ function rotaryCheck() {
613626function runRotary ( index ) {
614627 return new Promise ( ( resolve , reject ) => {
615628 const rotarbody = cookie + '&num=' + index ;
616- const time = new Date ( ) . getTime ( ) ;
617- const url = {
618- url : `https://kd.youth.cn/WebApi/RotaryTable/chestReward?_=${ time } ` ,
619- headers :{
620- 'Referer' :'https://kd.youth.cn/html/rotaryTable/index.html?' + cookie
621- } ,
622- body : rotarbody
623- }
624- $ . post ( url , ( error , resp , data ) => {
629+ $ . post ( kdHost ( `WebApi/RotaryTable/chestReward?_=${ Date . now ( ) } &` , rotarbody ) , ( error , resp , data ) => {
625630 let rotaryresp = JSON . parse ( data ) ;
626631 //$.log(formatJson(data));
627632 if ( rotaryresp . status == 1 ) {
@@ -639,15 +644,7 @@ function runRotary(index) {
639644//转盘双倍奖励
640645function TurnDouble ( ) {
641646 return new Promise ( ( resolve , reject ) => {
642- let time = new Date ( ) . getTime ( ) ;
643- const url = {
644- url : `https://kd.youth.cn/WebApi/RotaryTable/toTurnDouble?_=${ time } ` ,
645- headers : {
646- 'Referer' : 'https://kd.youth.cn/html/rotaryTable/index.html?' + cookie
647- } ,
648- body : cookie
649- }
650- $ . post ( url , ( error , resp , data ) => {
647+ $ . post ( kdHost ( `WebApi/RotaryTable/toTurnDouble?_=${ Date . now ( ) } &` , cookie ) , ( error , resp , data ) => {
651648 try {
652649 let Doubleres = JSON . parse ( data ) ;
653650 if ( Doubleres . data . is_double == 1 ) {
@@ -691,6 +688,6 @@ async function showmsg() {
691688 }
692689}
693690
694- function GetCookie ( ) { if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ N e w T a s k I o s \/ g e t T a s k L i s t / ) ) { RefererVal = $request . headers . Referer ; signheaderVal = RefererVal . match ( / & u i d = \d + / ) + RefererVal . match ( / & c o o k i e = [ _ a - z A - Z 0 - 9 - ] + / ) + RefererVal . match ( / & c o o k i e _ i d = [ a - z A - Z 0 - 9 ] + / ) ; if ( signheaderVal ) $ . setdata ( signheaderVal , 'youthheader_zq' ) ; $ . log ( `${ $ . name } 获取Cookie: 成功, signheaderVal: $}` ) ; $ . msg ( $ . name , `获取Cookie: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ a r t i c l e \/ c o m p l e t e / ) ) { const articlebodyVal = $request . body ; if ( articlebodyVal ) $ . setdata ( articlebodyVal , 'read_zq' ) ; $ . log ( `${ $ . name } 获取阅读: 成功, articlebodyVal: ${ articlebodyVal } ` ) ; $ . msg ( $ . name , `获取阅读请求: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ v 5 \/ u s e r \/ s t a y / ) ) { const timebodyVal = $request . body ; if ( timebodyVal ) $ . setdata ( timebodyVal , 'readtime_zq' ) ; $ . log ( `${ $ . name } 获取阅读时长: 成功, timebodyVal: ${ timebodyVal } ` ) ; $ . msg ( $ . name , `获取阅读时长: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ a r t i c l e \/ r e d _ p a c k e t / ) ) { const redpbodyVal = $request . body ; if ( redpbodyVal ) $ . setdata ( redpbodyVal , 'red_zq' ) ; $ . log ( `${ $ . name } 获取惊喜红包: 成功, redpbodyVal: ${ redpbodyVal } ` ) ; $ . msg ( $ . name , `获取惊喜红包请求: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ w i t h d r a w \d ? \. j s o n / ) ) { const withdrawVal = $request . body ; const withdrawUrl = $request . url ; if ( withdrawVal ) $ . setdata ( withdrawVal , 'cashbody_zq' ) ; if ( withdrawUrl ) $ . setdata ( withdrawUrl , 'cashurl_zq' ) ; $ . log ( `${ $ . name } , 获取提现请求: 成功, withdrawUrl: ${ withdrawUrl } ` ) ; $ . log ( `${ $ . name } , 获取提现请求: 成功, withdrawBody: ${ withdrawVal } ` ) ; $ . msg ( $ . name , `获取提现请求: 成功🎉` , `` ) } }
691+ function GetCookie ( ) { if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ N e w T a s k I o s \/ g e t T a s k L i s t / ) ) { RefererVal = $request . headers . Referer ; signheaderVal = RefererVal . match ( / & u i d = \d + / ) + RefererVal . match ( / & c o o k i e = [ _ a - z A - Z 0 - 9 - ] + / ) + RefererVal . match ( / & c o o k i e _ i d = [ a - z A - Z 0 - 9 ] + / ) ; if ( signheaderVal ) $ . setdata ( signheaderVal , 'youthheader_zq' ) ; $ . log ( `${ $ . name } 获取Cookie: 成功, signheaderVal: $}` ) ; $ . msg ( $ . name , `获取Cookie: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ a r t i c l e \/ c o m p l e t e / ) ) { const articlebodyVal = $request . body ; if ( articlebodyVal ) $ . setdata ( articlebodyVal , 'read_zq' ) ; $ . log ( `${ $ . name } 获取阅读: 成功, articlebodyVal: ${ articlebodyVal } ` ) ; $ . msg ( $ . name , `获取阅读请求: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ v 5 \/ u s e r \/ a p p _ s t a y / ) ) { const timebodyVal = $request . body ; if ( timebodyVal ) $ . setdata ( timebodyVal , 'readtime_zq' ) ; $ . log ( `${ $ . name } 获取阅读时长: 成功, timebodyVal: ${ timebodyVal } ` ) ; $ . msg ( $ . name , `获取阅读时长: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ a r t i c l e \/ r e d _ p a c k e t / ) ) { const redpbodyVal = $request . body ; if ( redpbodyVal ) $ . setdata ( redpbodyVal , 'red_zq' ) ; $ . log ( `${ $ . name } 获取惊喜红包: 成功, redpbodyVal: ${ redpbodyVal } ` ) ; $ . msg ( $ . name , `获取惊喜红包请求: 成功🎉` , `` ) } else if ( $request && $request . method != `OPTIONS` && $request . url . match ( / \/ w i t h d r a w \d ? \. j s o n / ) ) { const withdrawVal = $request . body ; const withdrawUrl = $request . url ; if ( withdrawVal ) $ . setdata ( withdrawVal , 'cashbody_zq' ) ; if ( withdrawUrl ) $ . setdata ( withdrawUrl , 'cashurl_zq' ) ; $ . log ( `${ $ . name } , 获取提现请求: 成功, withdrawUrl: ${ withdrawUrl } ` ) ; $ . log ( `${ $ . name } , 获取提现请求: 成功, withdrawBody: ${ withdrawVal } ` ) ; $ . msg ( $ . name , `获取提现请求: 成功🎉` , `` ) } }
695692
696693function Env ( t , e ) { class s { constructor ( t ) { this . env = t } send ( t , e = "GET" ) { t = "string" == typeof t ?{ url :t } :t ; let s = this . get ; return "POST" === e && ( s = this . post ) , new Promise ( ( e , i ) => { s . call ( this , t , ( t , s , r ) => { t ?i ( t ) :e ( s ) } ) } ) } get ( t ) { return this . send . call ( this . env , t ) } post ( t ) { return this . send . call ( this . env , t , "POST" ) } } return new class { constructor ( t , e ) { this . name = t , this . http = new s ( this ) , this . data = null , this . dataFile = "box.dat" , this . logs = [ ] , this . isMute = ! 1 , this . isNeedRewrite = ! 1 , this . logSeparator = "\n" , this . startTime = ( new Date ) . getTime ( ) , Object . assign ( this , e ) , this . log ( "" , `\ud83d\udd14${ this . name } , \u5f00\u59cb!` ) } isNode ( ) { return "undefined" != typeof module && ! ! module . exports } isQuanX ( ) { return "undefined" != typeof $task } isSurge ( ) { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon ( ) { return "undefined" != typeof $loon } toObj ( t , e = null ) { try { return JSON . parse ( t ) } catch { return e } } toStr ( t , e = null ) { try { return JSON . stringify ( t ) } catch { return e } } getjson ( t , e ) { let s = e ; const i = this . getdata ( t ) ; if ( i ) try { s = JSON . parse ( this . getdata ( t ) ) } catch { } return s } setjson ( t , e ) { try { return this . setdata ( JSON . stringify ( t ) , e ) } catch { return ! 1 } } getScript ( t ) { return new Promise ( e => { this . get ( { url :t } , ( t , s , i ) => e ( i ) ) } ) } runScript ( t , e ) { return new Promise ( s => { let i = this . getdata ( "@chavy_boxjs_userCfgs.httpapi" ) ; i = i ?i . replace ( / \n / g, "" ) . trim ( ) :i ; let r = this . getdata ( "@chavy_boxjs_userCfgs.httpapi_timeout" ) ; r = r ?1 * r :20 , r = e && e . timeout ?e . timeout :r ; const [ o , h ] = i . split ( "@" ) , a = { url :`http://${ h } /v1/scripting/evaluate` , body :{ script_text :t , mock_type :"cron" , timeout :r } , headers :{ "X-Key" :o , Accept :"*/*" } } ; this . post ( a , ( t , e , i ) => s ( i ) ) } ) . catch ( t => this . logErr ( t ) ) } loaddata ( ) { if ( ! this . isNode ( ) ) return { } ; { this . fs = this . fs ?this . fs :require ( "fs" ) , this . path = this . path ?this . path :require ( "path" ) ; const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) , s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) ; if ( ! s && ! i ) return { } ; { const i = s ?t :e ; try { return JSON . parse ( this . fs . readFileSync ( i ) ) } catch ( t ) { return { } } } } } writedata ( ) { if ( this . isNode ( ) ) { this . fs = this . fs ?this . fs :require ( "fs" ) , this . path = this . path ?this . path :require ( "path" ) ; const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) , s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) , r = JSON . stringify ( this . data ) ; s ?this . fs . writeFileSync ( t , r ) :i ?this . fs . writeFileSync ( e , r ) :this . fs . writeFileSync ( t , r ) } } lodash_get ( t , e , s ) { const i = e . replace ( / \[ ( \d + ) \] / g, ".$1" ) . split ( "." ) ; let r = t ; for ( const t of i ) if ( r = Object ( r ) [ t ] , void 0 === r ) return s ; return r } lodash_set ( t , e , s ) { return Object ( t ) !== t ?t :( Array . isArray ( e ) || ( e = e . toString ( ) . match ( / [ ^ . [ \] ] + / g) || [ ] ) , e . slice ( 0 , - 1 ) . reduce ( ( t , s , i ) => Object ( t [ s ] ) === t [ s ] ?t [ s ] :t [ s ] = Math . abs ( e [ i + 1 ] ) >> 0 == + e [ i + 1 ] ?[ ] :{ } , t ) [ e [ e . length - 1 ] ] = s , t ) } getdata ( t ) { let e = this . getval ( t ) ; if ( / ^ @ / . test ( t ) ) { const [ , s , i ] = / ^ @ ( .* ?) \. ( .* ?) $ / . exec ( t ) , r = s ?this . getval ( s ) :"" ; if ( r ) try { const t = JSON . parse ( r ) ; e = t ?this . lodash_get ( t , i , "" ) :e } catch ( t ) { e = "" } } return e } setdata ( t , e ) { let s = ! 1 ; if ( / ^ @ / . test ( e ) ) { const [ , i , r ] = / ^ @ ( .* ?) \. ( .* ?) $ / . exec ( e ) , o = this . getval ( i ) , h = i ?"null" === o ?null :o || "{}" :"{}" ; try { const e = JSON . parse ( h ) ; this . lodash_set ( e , r , t ) , s = this . setval ( JSON . stringify ( e ) , i ) } catch ( e ) { const o = { } ; this . lodash_set ( o , r , t ) , s = this . setval ( JSON . stringify ( o ) , i ) } } else s = this . setval ( t , e ) ; return s } getval ( t ) { return this . isSurge ( ) || this . isLoon ( ) ?$persistentStore . read ( t ) :this . isQuanX ( ) ?$prefs . valueForKey ( t ) :this . isNode ( ) ?( this . data = this . loaddata ( ) , this . data [ t ] ) :this . data && this . data [ t ] || null } setval ( t , e ) { return this . isSurge ( ) || this . isLoon ( ) ?$persistentStore . write ( t , e ) :this . isQuanX ( ) ?$prefs . setValueForKey ( t , e ) :this . isNode ( ) ?( this . data = this . loaddata ( ) , this . data [ e ] = t , this . writedata ( ) , ! 0 ) :this . data && this . data [ e ] || null } initGotEnv ( t ) { this . got = this . got ?this . got :require ( "got" ) , this . cktough = this . cktough ?this . cktough :require ( "tough-cookie" ) , this . ckjar = this . ckjar ?this . ckjar :new this . cktough . CookieJar , t && ( t . headers = t . headers ?t . headers :{ } , void 0 === t . headers . Cookie && void 0 === t . cookieJar && ( t . cookieJar = this . ckjar ) ) } get ( t , e = ( ( ) => { } ) ) { t . headers && ( delete t . headers [ "Content-Type" ] , delete t . headers [ "Content-Length" ] ) , this . isSurge ( ) || this . isLoon ( ) ?( this . isSurge ( ) && this . isNeedRewrite && ( t . headers = t . headers || { } , Object . assign ( t . headers , { "X-Surge-Skip-Scripting" :! 1 } ) ) , $httpClient . get ( t , ( t , s , i ) => { ! t && s && ( s . body = i , s . statusCode = s . status ) , e ( t , s , i ) } ) ) :this . isQuanX ( ) ?( this . isNeedRewrite && ( t . opts = t . opts || { } , Object . assign ( t . opts , { hints :! 1 } ) ) , $task . fetch ( t ) . then ( t => { const { statusCode :s , statusCode :i , headers :r , body :o } = t ; e ( null , { status :s , statusCode :i , headers :r , body :o } , o ) } , t => e ( t ) ) ) :this . isNode ( ) && ( this . initGotEnv ( t ) , this . got ( t ) . on ( "redirect" , ( t , e ) => { try { if ( t . headers [ "set-cookie" ] ) { const s = t . headers [ "set-cookie" ] . map ( this . cktough . Cookie . parse ) . toString ( ) ; this . ckjar . setCookieSync ( s , null ) , e . cookieJar = this . ckjar } } catch ( t ) { this . logErr ( t ) } } ) . then ( t => { const { statusCode :s , statusCode :i , headers :r , body :o } = t ; e ( null , { status :s , statusCode :i , headers :r , body :o } , o ) } , t => { const { message :s , response :i } = t ; e ( s , i , i && i . body ) } ) ) } post ( t , e = ( ( ) => { } ) ) { if ( t . body && t . headers && ! t . headers [ "Content-Type" ] && ( t . headers [ "Content-Type" ] = "application/x-www-form-urlencoded" ) , t . headers && delete t . headers [ "Content-Length" ] , this . isSurge ( ) || this . isLoon ( ) ) this . isSurge ( ) && this . isNeedRewrite && ( t . headers = t . headers || { } , Object . assign ( t . headers , { "X-Surge-Skip-Scripting" :! 1 } ) ) , $httpClient . post ( t , ( t , s , i ) => { ! t && s && ( s . body = i , s . statusCode = s . status ) , e ( t , s , i ) } ) ; else if ( this . isQuanX ( ) ) t . method = "POST" , this . isNeedRewrite && ( t . opts = t . opts || { } , Object . assign ( t . opts , { hints :! 1 } ) ) , $task . fetch ( t ) . then ( t => { const { statusCode :s , statusCode :i , headers :r , body :o } = t ; e ( null , { status :s , statusCode :i , headers :r , body :o } , o ) } , t => e ( t ) ) ; else if ( this . isNode ( ) ) { this . initGotEnv ( t ) ; const { url :s , ...i } = t ; this . got . post ( s , i ) . then ( t => { const { statusCode :s , statusCode :i , headers :r , body :o } = t ; e ( null , { status :s , statusCode :i , headers :r , body :o } , o ) } , t => { const { message :s , response :i } = t ; e ( s , i , i && i . body ) } ) } } time ( t ) { let e = { "M+" :( new Date ) . getMonth ( ) + 1 , "d+" :( new Date ) . getDate ( ) , "H+" :( new Date ) . getHours ( ) , "m+" :( new Date ) . getMinutes ( ) , "s+" :( new Date ) . getSeconds ( ) , "q+" :Math . floor ( ( ( new Date ) . getMonth ( ) + 3 ) / 3 ) , S :( new Date ) . getMilliseconds ( ) } ; / ( y + ) / . test ( t ) && ( t = t . replace ( RegExp . $1 , ( ( new Date ) . getFullYear ( ) + "" ) . substr ( 4 - RegExp . $1 . length ) ) ) ; for ( let s in e ) new RegExp ( "(" + s + ")" ) . test ( t ) && ( t = t . replace ( RegExp . $1 , 1 == RegExp . $1 . length ?e [ s ] :( "00" + e [ s ] ) . substr ( ( "" + e [ s ] ) . length ) ) ) ; return t } msg ( e = t , s = "" , i = "" , r ) { const o = t => { if ( ! t ) return t ; if ( "string" == typeof t ) return this . isLoon ( ) ?t :this . isQuanX ( ) ?{ "open-url" :t } :this . isSurge ( ) ?{ url :t } :void 0 ; if ( "object" == typeof t ) { if ( this . isLoon ( ) ) { let e = t . openUrl || t . url || t [ "open-url" ] , s = t . mediaUrl || t [ "media-url" ] ; return { openUrl :e , mediaUrl :s } } if ( this . isQuanX ( ) ) { let e = t [ "open-url" ] || t . url || t . openUrl , s = t [ "media-url" ] || t . mediaUrl ; return { "open-url" :e , "media-url" :s } } if ( this . isSurge ( ) ) { let e = t . url || t . openUrl || t [ "open-url" ] ; return { url :e } } } } ; this . isMute || ( this . isSurge ( ) || this . isLoon ( ) ?$notification . post ( e , s , i , o ( r ) ) :this . isQuanX ( ) && $notify ( e , s , i , o ( r ) ) ) ; let h = [ "" , "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3==============" ] ; h . push ( e ) , s && h . push ( s ) , i && h . push ( i ) , console . log ( h . join ( "\n" ) ) , this . logs = this . logs . concat ( h ) } log ( ...t ) { t . length > 0 && ( this . logs = [ ...this . logs , ...t ] ) , console . log ( t . join ( this . logSeparator ) ) } logErr ( t , e ) { const s = ! this . isSurge ( ) && ! this . isQuanX ( ) && ! this . isLoon ( ) ; s ?this . log ( "" , `\u2757\ufe0f${ this . name } , \u9519\u8bef!` , t . stack ) :this . log ( "" , `\u2757\ufe0f${ this . name } , \u9519\u8bef!` , t ) } wait ( t ) { return new Promise ( e => setTimeout ( e , t ) ) } done ( t = { } ) { const e = ( new Date ) . getTime ( ) , s = ( e - this . startTime ) / 1e3 ; this . log ( "" , `\ud83d\udd14${ this . name } , \u7ed3\u675f! \ud83d\udd5b ${ s } \u79d2` ) , this . log ( ) , ( this . isSurge ( ) || this . isQuanX ( ) || this . isLoon ( ) ) && $done ( t ) } } ( t , e ) }
0 commit comments