mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Change to axios as there is no way to get the profile pic via the raw
html & remove the legacy hot news by google rss window, (it is still accessable via the tty interface) and update i18n with the aboutNewsOrg thingy added articles (that currently does not work) & also added the privacy policy & tos page, both only accessbile via the tty interface for now. It will be avaible via the settings interface.
This commit is contained in:
parent
12455ebd28
commit
f0e33905b8
10 changed files with 74 additions and 14 deletions
|
@ -1,3 +1,4 @@
|
|||
// TODO Add caching
|
||||
import * as cheerio from "cheerio";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
|
@ -24,8 +25,9 @@ export default defineEventHandler(async (event) => {
|
|||
.text()
|
||||
.replace(/.css-.*\}/, "");
|
||||
const description = html("p.description").text();
|
||||
const logoClue = html("div.editor").contents();
|
||||
const logo =
|
||||
html("div.editor div figure img").attr("srcset") ||
|
||||
logoClue.find("img").attr("srcset") ||
|
||||
html("div.editor div figure img").attr("src") ||
|
||||
"";
|
||||
const bgImage = html("figure.keyVisual img").attr("srcset") || "";
|
||||
|
@ -49,10 +51,11 @@ export default defineEventHandler(async (event) => {
|
|||
}
|
||||
});
|
||||
return {
|
||||
name: newsOrgName,
|
||||
title: newsOrgName,
|
||||
description: description,
|
||||
logo: logo,
|
||||
articles: otherArticles,
|
||||
logoClue: String(logoClue),
|
||||
};
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue