change selectors to fit the new design

This commit is contained in:
Fran Jurmanović
2024-08-16 23:00:39 +02:00
parent 3c6bdeab60
commit 43b4757696
4 changed files with 13 additions and 9 deletions

View File

@@ -7,8 +7,9 @@ export async function getImgTitle(href: string): Promise<Legica> {
const html = response.data;
const $ = cheerio.load(html);
const title = $(".Article-inner > h1").text();
const { src: img } = $(".Article-media > img").attr() || {};
const title = $(".article-title-container > h1").text();
const src = $(".image-holder", ".article-content").find("img").attr("src");
if (!src) throw new Error(`Image not found at ${href}.`);
return { title, img };
return { title, img: src };
}