news-analyze/server/scrape/line_today.ts
吳元皓 5f78e8c58a Mainly make the python code to make it javascript for nuxt to access.
Python is just used for testing stuff, as it is a fine lang to do so.
2025-05-18 09:28:08 +08:00

24 lines
759 B
TypeScript

import JSSoup from "jssoup";
async function lineToday(slug: string) {
const url = "https://today.line.me/tw/v2/article/" + slug;
const fetchPageCode = await fetch(url, {
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
Accept: "*",
"Accept-Language": "zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"Accept-Encoding": "gzip, deflate, br",
Connection: "keep-alive",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Cache-Control": "max-age=0",
},
});
const data = fetchPageCode.text();
const soup = new JSSoup(data);
}
export default lineToday;