Skip to content

Commit

Permalink
Add ogImage, ogUrl helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 25, 2024
1 parent ac3bd0d commit 41a6806
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/Scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 41a6806

Please sign in to comment.