@@ -6,13 +6,13 @@ const cookieVal = chavy.getdata(cookieKey)
66sign ( )
77
88function sign ( ) {
9- let url = {
10- url : `https://tieba.baidu.com/mo/q/newmoindex` ,
11- headers : {
12- Cookie : cookieVal
13- }
14- }
9+ signTieba ( )
10+ signWenku ( )
11+ signZhidao ( )
12+ }
1513
14+ function signTieba ( ) {
15+ let url = { url : `https://tieba.baidu.com/mo/q/newmoindex` , headers : { Cookie : cookieVal } }
1616 chavy . post ( url , ( error , response , data ) => {
1717 let result = JSON . parse ( data )
1818 let tbs = result . data . tbs
@@ -54,13 +54,69 @@ function sign() {
5454function signBar ( bar , tbs , cb ) {
5555 let url = {
5656 url : `https://tieba.baidu.com/sign/add` ,
57- method : 'POST' ,
5857 headers : { Cookie : cookieVal } ,
5958 body : `ie=utf-8&kw=${ bar . forum_name . split ( '&' ) . join ( '%26' ) } &tbs=${ tbs } `
6059 }
6160 chavy . post ( url , cb )
6261}
6362
63+ function signWenku ( ) {
64+ let url = { url : `https://wenku.baidu.com/task/submit/signin` , headers : { Cookie : cookieVal } }
65+ url . headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded; charset=UTF-8'
66+ chavy . get ( url , ( error , response , data ) => {
67+ const signresult = JSON . parse ( data )
68+ const title = '百度文库'
69+ let subTitle = ''
70+ let detail = ''
71+ if ( signresult . errno == '0' ) {
72+ subTitle = '签到结果: 成功'
73+ chavy . msg ( title , subTitle , detail )
74+ chavy . log ( `[${ title } ] ${ subTitle } ` )
75+ } else {
76+ subTitle = '签到结果: 未知'
77+ detail = '详见日志'
78+ chavy . msg ( title , subTitle , detail )
79+ chavy . log ( `[${ title } ] 签到结果: 未知, ${ data } ` )
80+ }
81+ } )
82+ }
83+
84+ function signZhidao ( ) {
85+ let url = {
86+ url : `https://zhidao.baidu.com/` ,
87+ headers : { Cookie : cookieVal }
88+ }
89+ chavy . get ( url , ( error , response , data ) => {
90+ const timestamp = Date . parse ( new Date ( ) )
91+ const utdata = `61,61,7,0,0,0,12,61,5,2,12,4,24,5,4,1,4,${ timestamp } `
92+ const stoken = [ ...data . matchAll ( / " s t o k e n " [ ^ " ] * " ( [ ^ " ] * ) " / g) ] [ 0 ] [ 1 ]
93+ const signurl = { url : `https://zhidao.baidu.com/submit/user` , headers : { Cookie : cookieVal } , body : { } }
94+ signurl . body = `cm=100509&utdata=${ utdata } &stoken=${ stoken } `
95+ chavy . post ( signurl , ( signerror , signresp , signdata ) => {
96+ const signresult = JSON . parse ( signdata )
97+ const title = '百度知道'
98+ let subTitle = ''
99+ let detail = ''
100+ if ( signresult . errorNo == 0 ) {
101+ subTitle = '签到结果: 成功'
102+ detail = `活跃: ${ signresult . data . signInDataNum } 天, 说明: ${ signresult . errorMsg } `
103+ chavy . msg ( title , subTitle , detail )
104+ chavy . log ( `[${ title } ] ${ subTitle } , ${ signdata } ` )
105+ } else if ( signresult . errorNo == 2 ) {
106+ subTitle = `签到结果: 成功 (重复签到)`
107+ detail = `活跃: ${ signresult . data . signInDataNum } 天, 说明: ${ signresult . errorMsg } `
108+ chavy . msg ( title , subTitle , detail )
109+ chavy . log ( `[${ title } ] ${ subTitle } , ${ signdata } ` )
110+ } else {
111+ subTitle = '签到结果: 失败'
112+ detail = `说明: ${ signresult . errorMsg } `
113+ chavy . msg ( title , subTitle , detail )
114+ chavy . log ( `[${ title } ] ${ subTitle } ` )
115+ }
116+ } )
117+ } )
118+ }
119+
64120function check ( forums , signinfo , checkms = 0 ) {
65121 let title = `${ cookieName } `
66122 let subTitle = ``
0 commit comments