Skip to content

Instantly share code, notes, and snippets.

@wintrdotcom
Created September 13, 2020 22:54
Show Gist options
  • Save wintrdotcom/f74ff118ec5d6d0c8106ff6a99e9d500 to your computer and use it in GitHub Desktop.
Save wintrdotcom/f74ff118ec5d6d0c8106ff6a99e9d500 to your computer and use it in GitHub Desktop.
Extract the metadata of any webpage, get a free WINTR API key on https://www.wintr.com
const WINTR_API_KEY = "your_wintr_api_key"
const TARGET_URL = "https://github.com"
const axios = require("axios")
const options = {
method: "post",
responseType: "json",
data: {
"apikey": WINTR_API_KEY,
"url": TARGET_URL,
"outputschema": {
"metas": {
"group": "html > head > meta",
"data": {
"name": {
"selector": "meta",
"attr": "name"
},
"property": {
"selector": "meta",
"attr": "property"
},
"content": {
"selector": "meta",
"attr": "content"
}
}
}
}
},
url: "https://api.wintr.com/fetch"
}
axios(options)
.then((result) => {
console.log(result.data.content)
})
.catch((err) => {
console.error(err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment