-
Notifications
You must be signed in to change notification settings - Fork 2
/
QX-VVeboTimeline.js
24 lines (24 loc) · 1.02 KB
/
QX-VVeboTimeline.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
let url = $request.url;
let hasUid = (url) => url.includes("uid");
let getUid = (url) => (hasUid(url) ? url.match(/uid=(\d+)/)[1] : undefined);
if (url.includes("remind/unread_count")) {
$prefs.setValueForKey(getUid(url), "uid");
$done({});
} else if (url.includes("statuses/user_timeline")) {
let uid = getUid(url) || $prefs.valueForKey("uid");
url = url.replace("statuses/user_timeline", "profile/statuses/tab").replace("max_id", "since_id");
url = url + `&containerid=230413${uid}_-_WEIBO_SECOND_PROFILE_WEIBO`;
$done({ url });
} else if (url.includes("profile/statuses/tab")) {
let data = JSON.parse($response.body);
let statuses = data.cards
.map((card) => (card.card_group ? card.card_group : card))
.flat()
.filter((card) => card.card_type === 9)
.map((card) => card.mblog)
.map((status) => (status.isTop ? { ...status, label: "置顶" } : status));
let sinceId = data.cardlistInfo.since_id;
$done({ body: JSON.stringify({ statuses, since_id: sinceId, total_number: 100 }) });
} else {
$done({});
}