From 41a6806d6f7888fcd8a14bd01875d6961379f119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 25 Jan 2024 21:02:32 +0200 Subject: [PATCH] Add ogImage, ogUrl helpers --- src/core/Scraper.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/Scraper.ts b/src/core/Scraper.ts index 44c3293..163180c 100644 --- a/src/core/Scraper.ts +++ b/src/core/Scraper.ts @@ -25,6 +25,14 @@ export class Scraper { return element?.getAttribute("content"); } + public ogImage(document: Document) { + return this.metaProperty(document, "og:image"); + } + + public ogUrl(document: Document) { + return this.metaProperty(document, "og:url"); + } + public textContent(document: Document, selector: string) { return document.querySelector(selector)?.textContent; }