Created
September 13, 2020 22:54
-
-
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
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 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