Public
Script
December 13, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { post_bilibili } from "./bilibili_methods";
function randint(x) {
return Math.floor(Math.random() * x);
}
const watch_video_url = "http://api.bilibili.com/x/v2/history/report";
// watch a bilibili video for a random time less than its duration
export async function watch_video(video, cookie) {
let watch_video_data = {
aid: video.aid,
cid: video.cid,
progress: randint(video.duration),
csrf: cookie.bilijct,
};
await post_bilibili(watch_video_url, watch_video_data, cookie);
// if no error has occured, then a video has been watched successfully.
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
December 13, 2023