From 1dd324e0caaec4986332283ac57c3a9cbd3dea7d Mon Sep 17 00:00:00 2001 From: Howard Date: Mon, 2 Jun 2025 00:27:12 +0800 Subject: [PATCH] Got the news id system working. Oh wait, this should be in the tab system... --- README.md | 2 ++ server/scrape/line_today.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7d87135..ac11f53 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Reverse engineering documentation: [about](/about/) ## Before deploying, please know this: This code is absolutly NOT designed to be spinned up at Vercel or Netlify, it has the scraping system now inside of the main website code, oh also the entire "caching feature" is based in memory, so please don't use those platforms, for Zeabur your cost might be expensive. idk, I haven't tried it yet. The web url: https://news.yuanhau.com is hosted on my own infra, you should too. Please get a server off of yahoo 拍賣, 蝦皮 or eBay to do so. +## Note for developing. +The desktop enviroment is super unstable when even using a beefy computer, even so, the desktop will lag when opening the newsView, like it's just hates being in a dev env. Prod app works tho, so you can demo it using `bun run build && bun run preview` for demoing. Please don't file a issue request for this matter. If you have the fix, please contribute using Github PRs. ## Why? diff --git a/server/scrape/line_today.ts b/server/scrape/line_today.ts index 81e9ee4..f0f2245 100644 --- a/server/scrape/line_today.ts +++ b/server/scrape/line_today.ts @@ -89,8 +89,12 @@ async function lineToday(slug: string) { if (publishMatch) { publishedAt = findTime(publishMatch[1].trim()); } - const getAuthorUrl = html("entityPublishInfo-avatarLin").html(); - console.log(getAuthorUrl); + +const findPublisherUrl = html("a.entityPublishInfo-avatarLink").attr("href") || ""; +const publisherIdMatch = findPublisherUrl.match(/[0-9]{6}/); +const publisherId = publisherIdMatch ? publisherIdMatch[0] : ""; +console.log(publisherId); + return { title: title, paragraph: paragraph, @@ -99,7 +103,8 @@ async function lineToday(slug: string) { images: images, updateat: updatedAt, publishedat: publishedAt, - }; + publisherId: publisherId + }; } export default lineToday;