Created
May 19, 2022 10:33
-
-
Save SavvasStephanides/66532e27a5014aaecd4fedd92356265c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios") | |
const jsdom = require("jsdom") | |
const { JSDOM } = jsdom | |
async function run(){ | |
const url = "https://savvas.me/explained/promises" | |
let response = await axios.get(url) | |
let html = response.data | |
const page = new JSDOM(html) | |
let title = page.window.document.querySelector("meta[property='og:title']").getAttribute("content") | |
let thumbnail = page.window.document.querySelector("meta[property='og:image']").getAttribute("content") | |
console.log(title) | |
console.log(thumbnail) | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment