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

Function adVideoFinish

Script/Task/xmly.js:729–770  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

727}
728
729async function adVideoFinish(token){
730 let headers = {
731 "Cookie": config.xm_cookie,
732 'Content-Type': `application/json`
733 }
734 let body = `{"aid":112,"taskId":252,"token":"${token}","progress":1}`
735 let myRequest = {
736 url: `http://m.ximalaya.com/web-activity/task/v2/incrTaskProgress`,
737 headers: headers,
738 body: body
739 }
740 return await $.http.post(myRequest).then(
741 (response) => {
742 body = JSON.parse(response.body)
743 if (body.ret == 0) {
744 if (body.data.status == 0) {
745 $.log("- 本条视频广告观看已完成, 获得50点奖励")
746 config.watch.num += 1
747 config.watch.time = format(startTime)
748 $.setdata(JSON.stringify(config.watch), name + "_watch")
749 return true
750 } else if (body.data.status == -1) {
751 $.log("### 今日观看广告任务已全部完成 ✅ ")
752 config.watch.num = 6
753 config.watch.time = format(startTime)
754 $.setdata(JSON.stringify(config.watch), name + "_watch")
755 return true
756 } else {
757 $.log("- !!!未知完成状态")
758 $.log(JSON.stringify(body.data))
759 return false
760 }
761 } else {
762 $.log("- !!!观看广告任务交还失败")
763 return false
764 }
765 },(reason) => {
766 $.log("- !!!观看广告任务交还失败")
767 return false
768 }
769 )
770}
771
772async function takeGeneralTask(taskId){
773 let headers = {

Callers 1

mainFunction · 0.85

Calls 6

formatFunction · 0.70
postMethod · 0.45
parseMethod · 0.45
logMethod · 0.45
setdataMethod · 0.45
stringifyMethod · 0.45

Tested by

no test coverage detected