Skip to content

Commit

Permalink
fix: add more session token
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 3, 2023
1 parent c2c922c commit 3732b41
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils/3rd/bilibili.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { sample } from "lodash";

const run = async (bvId: string) => {
const requestUrl = `https://api.bilibili.com/x/web-interface/view?bvid=${bvId}`;
console.log(`fetch`, requestUrl);
const sessdata = sample(process.env.BILIBILI_SESSION_TOKEN?.split(","));
const headers = {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
Host: "api.bilibili.com",
Cookie: `SESSDATA=${process.env.BILIBILI_SESSION_TOKEN}`,
Cookie: `SESSDATA=${sessdata}`,
};
const response = await fetch(requestUrl, {
method: "GET",
Expand Down

0 comments on commit 3732b41

Please sign in to comment.