mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Archive the jssoup one for now
This commit is contained in:
parent
5f78e8c58a
commit
0bcb646cc0
4 changed files with 45 additions and 19 deletions
|
@ -1,20 +1,7 @@
|
|||
import lineToday from "~/server/scrape/line_today";
|
||||
export default defineEventHandler(async (event) => {
|
||||
const slug = getRouterParam(event, "slug");
|
||||
return new Promise((resolve, reject) => {
|
||||
const pythonProcess = spawn("python3", ["scraping/hot_articles.py"]);
|
||||
|
||||
let dataString = "";
|
||||
|
||||
pythonProcess.stdout.on("data", (data) => {
|
||||
dataString += data.toString();
|
||||
});
|
||||
|
||||
pythonProcess.stderr.on("data", (data) => {
|
||||
console.error(`Error: ${data}`);
|
||||
});
|
||||
|
||||
pythonProcess.on("close", (code) => {
|
||||
resolve({ status: "completed", output: dataString });
|
||||
});
|
||||
});
|
||||
const data = await lineToday(slug);
|
||||
console.log(data);
|
||||
return data;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue