use elysia instead of express

This commit is contained in:
Fran Jurmanović
2023-10-04 20:19:38 +02:00
parent aea2acbdf8
commit 82acbf93fc
21 changed files with 276 additions and 455 deletions

14
src/common/getImgTitle.ts Normal file
View File

@@ -0,0 +1,14 @@
import { Legica } from "@models";
import axios from "axios";
import cheerio from "cheerio";
export async function getImgTitle(href: string): Promise<Legica> {
const response = await axios.get(href);
const html = response.data;
const $ = cheerio.load(html);
const title = $(".Article-inner > h1").text();
const { src: img } = $(".Article-media > img").attr() || {};
return { title, img };
}