-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTaskHotBiliVideo.js
More file actions
64 lines (56 loc) · 2.23 KB
/
Copy pathTaskHotBiliVideo.js
File metadata and controls
64 lines (56 loc) · 2.23 KB
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
54
55
56
57
58
59
60
61
62
63
64
/*
#!name = bilibili星榜全网热播
#!author = 怎么肥事
#!update = 2024-07-07 12:25
[task_local]
0 18 * * * https://raw.githubusercontent.com/ZenmoFeiShi/Qx/main/TaskHotBiliVideo.js, tag=bilibili星榜, img-url=https://raw.githubusercontent.com/fmz200/wool_scripts/main/icons/apps/BiliBili.png, enabled=true
*/
const url = `https://api.bilibili.com/pgc/review/gateway/movie/rank/infos?rank_type=COMBINATION&scene_type=1`;
const method = `GET`;
const headers = {
'Sec-Fetch-Dest' : `empty`,
'Connection' : `keep-alive`,
'Accept-Encoding' : `gzip, deflate, br`,
'Sec-Fetch-Site' : `same-site`,
'Origin' : `https://m.bilibili.com`,
'Sec-Fetch-Mode' : `cors`,
'Host' : `api.bilibili.com`,
'Referer' : `https://m.bilibili.com/bangumi/v2/rank-list?navhide=1&from_spmid=creation.hot-tab.0.0&native.theme=1&night=0`,
'Accept-Language' : `zh-CN,zh-Hans;q=0.9`,
'Accept' : `application/json, text/plain, */*`
};
const body = ``;
const myRequest = {
url: url,
method: method,
headers: headers,
body: body
};
$task.fetch(myRequest).then(response => {
const obj = JSON.parse(response.body);
let output = "";
let notificationBody = "";
let firstMediaCover = "";
if (obj && obj.data && obj.data.rank_media_list) {
obj.data.rank_media_list.forEach((item, index) => {
const title = item.media_title;
const styles = item.media_style_list.map(style => style.name).join(", ");
const category = item.category_name;
output += (index + 1) + ". " + title + " [" + category + "]\n - " + styles + "\n\n";
notificationBody += (index + 1) + ". " + title + " (" + styles + ") - " + category + "\n";
if (index === 0) {
firstMediaCover = item.media_cover;
}
});
}
console.log(response.statusCode + "\n\n" + output);
if (firstMediaCover) {
$notify("bilibili星榜", "按过去两周热门稿件数量排序,每日18点更新", notificationBody, { 'media-url': firstMediaCover });
} else {
$notify("bilibili星榜", "按过去两周热门稿件数量排序,每日18点更新", notificationBody);
}
$done();
}, reason => {
console.log(reason.error);
$done();
});