mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 15:51:01 +08:00
Update more stuff, the shit fix is just rm -rf ing .nuxt .output
This commit is contained in:
parent
62833af4ae
commit
bb7ab3a088
@ -4,10 +4,8 @@ This took me some time, but they use a fancy system for pulling news data.
|
||||
|
||||
## Endpoint on news.yuanhau.com aka this repo (Cached results)
|
||||
|
||||
### /api/home/uuid_lt/action?query=${query}
|
||||
Fetches the uuid in each listings of the query
|
||||
|
||||
### /api/home/lt/${query}
|
||||
### /api/home/uuid_lt/feed?query=${query}
|
||||
Fetches the uuid and returns back with the news
|
||||
|
||||
## Main endpoint
|
||||
|
@ -71,6 +71,16 @@ async function tryToPullDataUUID(uuid: string) {
|
||||
"?country=tw&offset=0&length=27";
|
||||
const req = await fetch(buildUrl);
|
||||
const res = await req.json();
|
||||
return res.items;
|
||||
}
|
||||
|
||||
async function tryToPullDataNUUID(link: string) {
|
||||
const buildUrl =
|
||||
"https://today.line.me/webapi/recommendation/hybrid/listings/" +
|
||||
link +
|
||||
"?country=tw&maxVideoCount=0&offset=0&length=70&optOut=false";
|
||||
const req = await fetch(buildUrl);
|
||||
const res = await req.json();
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -91,7 +101,7 @@ export default defineEventHandler(async (event) => {
|
||||
const data = await tryToPullDataUUID(key);
|
||||
return data;
|
||||
}),
|
||||
);
|
||||
).then((ans) => ans.flat());
|
||||
const diffFormat = [];
|
||||
data.forEach((key) => {
|
||||
if (validUUIDs.includes(key)) {
|
||||
@ -101,10 +111,20 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
});
|
||||
const fillll = filter2(diffFormat);
|
||||
const cconaa: any[] = await Promise.all(
|
||||
fillll.map(async (key) => {
|
||||
if (key.includes("news_cat")) {
|
||||
const data = await tryToPullDataNUUID(key);
|
||||
return data;
|
||||
} else {
|
||||
}
|
||||
}),
|
||||
).then((ans) => ans.flat());
|
||||
return {
|
||||
valid: uniqueUUIDs,
|
||||
maybe: fillll,
|
||||
returnData: returnData,
|
||||
uuids: uniqueUUIDs,
|
||||
nuuid: fillll,
|
||||
uuidData: returnData,
|
||||
nuuiddata: cconaa,
|
||||
};
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user