18 lines
673 B
JavaScript
18 lines
673 B
JavaScript
import credentials from "./credentials.json" with { type: "json" };
|
|
var {pixiv_cookie, pixiv_user_id} = credentials;
|
|
|
|
var all_ids = [];
|
|
var offset = 0;
|
|
while (true) {
|
|
let url = `https://www.pixiv.net/ajax/user/${pixiv_user_id}/illusts/bookmarks?tag=&offset=${offset}&limit=100&rest=show&lang=en&version=5dc84ab282403a049abea4e2f2214b6a69d31da6`;
|
|
console.log("get", url);
|
|
let data = await fetch(url, {headers: {Cookie: pixiv_cookie}}).then(res => res.json());
|
|
let ids = data.body.works.map(x => x.id);
|
|
if (!ids.length) break;
|
|
for (let id of ids) {
|
|
all_ids.push(id);
|
|
}
|
|
offset += ids.length;
|
|
}
|
|
|
|
Deno.writeTextFileSync("past_bookmarks.json", JSON.stringify(all_ids)); |