MCPcopy Create free account
hub / github.com/ClydeTime/Surge / createComment

Function createComment

Script/Task/xmly.js:582–613  ·  view source on GitHub ↗
(uid, content)

Source from the content-addressed store, hash-verified

580}
581
582async function createComment(uid, content){
583 let headers = {
584 "Cookie": config.xm_cookie,
585 'Content-Type' : `application/x-www-form-urlencoded`
586 }
587 let body = `content=${content}&source=0&synchaos=1&timeStampType=1&trackId=424771991&uid=${uid}`
588 let myRequest = {
589 url: "https://mobile.ximalaya.com/comment-mobile/v1/create",
590 headers: headers,
591 body: body
592 }
593 let commentId = 0
594 return await $.http.post(myRequest).then(
595 (response) => {
596 body = JSON.parse(response.body)
597 if (body.ret == 0) {
598 $.log("- 评论成功")
599 commentId = body.id
600 } else if (body.ret == 801){
601 $.log("- !!!请勿发送相同内容")
602 }else if (body.ret == 805){
603 $.log("- !!!发送内容频繁")
604 } else {
605 $.log("- !!!评论失败")
606 }
607 return commentId
608 },(reason) => {
609 $.log("- !!!评论失败")
610 return commentId
611 }
612 )
613}
614
615async function deleteComment(commentId){
616 let headers = {

Callers 1

mainFunction · 0.85

Calls 3

postMethod · 0.45
parseMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected