-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneteasemusic.js
53 lines (47 loc) · 1.29 KB
/
neteasemusic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
*
* [MITM]
* music.163.com
*
* [rewrite_local]
* ^https:\/\/music\.163\.com\/m\/ url script-response-body neteasemusic.cookie.js
*
* [task_local]
* 1 0 0 * * neteasemusic.js
*
*/
function sign() {
const cookieName = '网易云音乐'
const cookieKey = 'chavy_cookie_neteasemusic'
const cookieVal = $prefs.valueForKey(cookieKey)
const pc = `http://music.163.com/api/point/dailyTask?type=1`
const mobile = `http://music.163.com/api/point/dailyTask?type=0`
let url = {
url: null,
headers: {
Cookie: cookieVal
}
}
url.url = pc
$task.fetch(url).then((response) => {
log('网易云音乐(PC端)', response.body)
})
url.url = mobile
$task.fetch(url).then((response) => {
log('网易云音乐(移动端)', response.body)
})
}
function log(title, data) {
let result = JSON.parse(data)
if (result.code == 200) {
console.log(`签到成功: ${title}`)
$notify('签到成功', title, '')
} else if (result.code == -2) {
console.log(`签到跳过: ${title}, 编码: ${result.code}, 原因: ${result.msg}`)
$notify('签到跳过', title, `原因: ${result.msg}`)
} else {
console.log(`签到失败: ${title}, 编码: ${result.code}, 原因: ${result.msg}`)
$notify('签到失败', title, `原因: ${result.msg}`)
}
}
sign()