Public
Express
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
export async function nyt(req: express.Request, res: express.Response) {
const data = await fetchText(
"https://cn.nytimes.com/",
{
headers: {
origin: "https://cn.nytimes.com",
referer: "https://cn.nytimes.com",
"User-Agent":
"Mozilla/5.0 (Linux; Android 10; LIO-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.136 Mobile Safari/537.36",
},
},
);
return res.send(data);
}
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!
baj-nyt.express.val.run
October 23, 2023