mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 05:24:23 +00:00
Update some stuff & remove unneed code like python stuff, it is in the
web app.
This commit is contained in:
parent
bc9a63f6ab
commit
62fa31ae4a
24 changed files with 104 additions and 2580 deletions
|
@ -6,7 +6,8 @@ interface CacheItem {
|
|||
const cache: Record<string, CacheItem> = {};
|
||||
const CACHE_DURATION = 1000 * 60 * 60; // 1 Hour
|
||||
|
||||
async function getLineTodayData(type: string) {
|
||||
async function getLineTodayData(orgtype: string) {
|
||||
const type = orgtype.toLowerCase();
|
||||
if (cache[type] && Date.now() - cache[type].timestamp < CACHE_DURATION) {
|
||||
console.log("Serving from cache for type:", type);
|
||||
return cache[type].data;
|
||||
|
@ -23,7 +24,7 @@ async function getLineTodayData(type: string) {
|
|||
},
|
||||
});
|
||||
const res = await req.json();
|
||||
const req2 = res.pageProps.fallback["getPageData,domestic"].modules;
|
||||
const req2 = res.pageProps.fallback[`getPageData,${type}`].modules;
|
||||
const req3 = [];
|
||||
req2.forEach((key) => {
|
||||
const listings = key.listings;
|
||||
|
@ -67,8 +68,16 @@ export default defineEventHandler(async (event) => {
|
|||
}
|
||||
const data = await getLineTodayData(String(query.query));
|
||||
const validUUIDs = filterUUIDs(data || []);
|
||||
const noDup = [];
|
||||
validUUIDs.forEach((key) => {
|
||||
if (noDup.includes(key)) {
|
||||
return;
|
||||
} else {
|
||||
noDup.push(key);
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: validUUIDs,
|
||||
data: noDup,
|
||||
cached: !!cache[String(query.query)],
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue