mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
it works rn ig?
This commit is contained in:
parent
8eb19d7242
commit
3ebaff5218
4 changed files with 39 additions and 13 deletions
|
@ -28,12 +28,25 @@ export default defineEventHandler(async (event) => {
|
|||
html("div.editor div figure img").attr("srcset") ||
|
||||
html("div.editor div figure img").attr("src") ||
|
||||
"";
|
||||
const bgImage = html("figure.keyVisual img").attr("srcset") || "";
|
||||
const articles = [];
|
||||
const otherArticles = html("section.moduleContainer div").html();
|
||||
/*for (const item in otherArticles) {
|
||||
console.log(item);
|
||||
console.log("-");
|
||||
}*/
|
||||
const regexArticleLinks = /[a-zA-Z0-9]{7}/g
|
||||
const otherArticles = <any[]>[];
|
||||
html("a.ltcp-link")
|
||||
.each((i, element) => {
|
||||
const articleLink = html(element).attr("href");
|
||||
const articleTitle = html(element).find("h3.header").text();
|
||||
const date = html(element).find("div._articleCard div.css-wqleh6 span").text();
|
||||
if (articleLink && articleTitle) {
|
||||
const articleSlug = articleLink.matchAll(regexArticleLinks);
|
||||
otherArticles.push({
|
||||
index: i,
|
||||
title: articleTitle,
|
||||
link: articleSlug,
|
||||
date: date,
|
||||
});
|
||||
}
|
||||
});
|
||||
return {
|
||||
name: newsOrgName,
|
||||
description: description,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue