Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { fetch } from "https://esm.town/v/std/fetch";
export async function bilitest(req: express.Request, res: express.Response) {
const axios = await fetch("npm:axios");
const url = "https://music.163.com/#/song?id=2008568696";
try {
const response = await axios(url, {
headers: {
"Access-Control-Allow-Origin": "*",
},
});
const data = response.data;
// 在这里对data进行处理
return res.send(data);
}
catch (error) {
console.error("Error:", error);
return res.status(500).send("Error occurred while accessing the URL.");
}
}
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!
October 23, 2023