mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 21:14:23 +00:00
Remove docs and added them back? And also made the return uuid thing
now an endpoint that can be logged & cached.
This commit is contained in:
parent
5c64ae08bf
commit
0dfbdb4c91
21 changed files with 31 additions and 55 deletions
8
build_docs_gh_workflow.sh
Normal file
8
build_docs_gh_workflow.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
cd ./docs/
|
||||
npm install -g vitepress
|
||||
bunx vitepress build
|
||||
cd ..
|
||||
cp -R ./docs/.vitepress/dist/ ./public/docs/
|
||||
echo "Done :)"
|
||||
exit 1
|
|
@ -1 +0,0 @@
|
|||
import{t as p}from"./chunks/theme.zLgzrmCh.js";import{R as s,a0 as i,a1 as u,a2 as c,a3 as l,a4 as f,a5 as d,a6 as m,a7 as h,a8 as g,a9 as A,d as v,u as y,v as C,s as P,aa as b,ab as w,ac as R,ad as E}from"./chunks/framework.WowTybjF.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=y();return C(()=>{P(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&b(),w(),R(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,3 @@
|
|||
import { gunzip } from "zlib";
|
||||
import { promisify } from "util";
|
||||
|
||||
const gunzipAsync = promisify(gunzip);
|
||||
|
||||
// Check /about/scraping_line_today_home.md for more info or https://news.yuanhau.com/datainfo/linetodayjsondata.json
|
||||
async function getLineTodayData(type: string) {
|
||||
try {
|
||||
|
@ -15,20 +10,28 @@ async function getLineTodayData(type: string) {
|
|||
"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",
|
||||
},
|
||||
});
|
||||
|
||||
const buffer = await req.arrayBuffer();
|
||||
const decompressed = await gunzipAsync(Buffer.from(buffer));
|
||||
const res = JSON.parse(decompressed.toString());
|
||||
const data = res.getPageData?.[type];
|
||||
return res;
|
||||
const res = await req.json();
|
||||
const req2 = res.pageProps.fallback["getPageData,domestic"].modules;
|
||||
const req3 = [];
|
||||
req2.forEach((key) => {
|
||||
const listings = key.listings;
|
||||
if (Array.isArray(listings)) {
|
||||
listings.forEach((listing) => {
|
||||
if (listing && listing.id) {
|
||||
req3.push(listing.id);
|
||||
}
|
||||
});
|
||||
} else if (listings && listings.id) {
|
||||
req3.push(listings.id);
|
||||
}
|
||||
});
|
||||
return req3;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function demo() {
|
||||
console.log(await getLineTodayData("domestic"));
|
||||
}
|
||||
demo();
|
||||
|
||||
//export default getLineTodayData;
|
||||
export default defineEventHandler(async (event) => {
|
||||
const slug = getRouterParam(event, "slug");
|
||||
return await getLineTodayData(slug);
|
||||
});
|
3
server/api/home/uuid_lt/index.ts
Normal file
3
server/api/home/uuid_lt/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default defineEventHandler((event) => {
|
||||
return sendRedirect(event, "/datainfo/linetodayjsondata.json", 302);
|
||||
});
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
[0mpageProps[2m:[0m {
|
||||
[0m__lang[2m:[0m [0m[32m[0m[32m"tw"[0m[0m[0m[2m,[0m
|
||||
[0m__namespaces[2m:[0m {
|
||||
[0mcommon[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mforYou[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mvideo[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mquiz[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mpoll[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
}[0m[2m,[0m
|
||||
[0mruntimeConfig[2m:[0m {
|
||||
[0mcountryConfig[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mCOMMIT_SHA[2m:[0m [0m[32m[0m[32m"fb546888"[0m[0m[0m[2m,[0m
|
||||
[0mDEPLOY_ENV[2m:[0m [0m[32m[0m[32m"release"[0m[0m[0m[2m,[0m
|
||||
[0mSENTRY_DSN[2m:[0m [0m[32m[0m[32m"https://8ca685e4ca2f4b2ba32b4459381f91b8@sentry-uit.line-apps.com/475"[0m[0m[0m[2m,[0m
|
||||
}[0m[2m,[0m
|
||||
[0m_sentryTraceData[2m:[0m [0m[32m[0m[32m"5c81d62ef22d861e5555ee0e170bd82b-a6d22f47579e751a-1"[0m[0m[0m[2m,[0m
|
||||
[0m_sentryBaggage[2m:[0m [0m[32m[0m[32m"sentry-environment=release,sentry-release=release%40fb546888,sentry-public_key=8ca685e4ca2f4b2ba32b4459381f91b8,sentry-trace_id=5c81d62ef22d861e5555ee0e170bd82b,sentry-transaction=getServerSideProps%20%2Fv3%2Ftab%2F%5B%5B...tabs%5D%5D,sentry-sampled=true"[0m[0m[0m[2m,[0m
|
||||
[0marticleDedupeState[2m:[0m {
|
||||
[0mpool[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0mserverPool[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
}[0m[2m,[0m
|
||||
[0mfallback[2m:[0m {
|
||||
[0mgetTabsData[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0m[32m"getPageData,domestic"[0m[2m:[0m [0m[36m[Object ...][0m[0m[2m,[0m
|
||||
[0m[32m"5e4ceeda408f3c5ca031940d_{\"offset\":5,\"length\":3}"[0m[2m:[0m [
|
||||
[0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m
|
||||
][0m[2m,[0m
|
||||
[0m[32m"5e4cee49408f3c5ca031940b_{\"offset\":0,\"length\":5}"[0m[2m:[0m [
|
||||
[0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m[0m[2m,[0m [0m[36m[Object ...][0m
|
||||
][0m[2m,[0m
|
||||
}[0m[2m,[0m
|
||||
}[0m[2m,[0m
|
||||
[0m__N_SSP[2m:[0m [0m[33mtrue[0m[0m[2m,[0m
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue