mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Add basic open articles for future feat. & ran prettier & now fetches data from the cloud aka line today.
This commit is contained in:
parent
96a7a3372c
commit
0c6f0cbcd8
11 changed files with 98 additions and 224 deletions
|
@ -1,16 +1,31 @@
|
|||
export default defineEventHandler(async (event) => {
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
text: "國內",
|
||||
url: "domestic",
|
||||
default: true,
|
||||
try {
|
||||
const buildUrl = `https://today.line.me/_next/data/v1/tw/v3/tab/${type}.json?tabs=${type}`;
|
||||
const req = await fetch(buildUrl, {
|
||||
headers: {
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
Accept: "application/json",
|
||||
"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",
|
||||
},
|
||||
{
|
||||
text: "國外",
|
||||
url: "global",
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
const res = await req.json();
|
||||
const req2 = res.pageProps.fallback.getTabsData.modules;
|
||||
return req2;
|
||||
} catch (e) {
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
text: "國內",
|
||||
url: "domestic",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
text: "國外",
|
||||
url: "global",
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue