Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A Node.js module to fetch HTML meta tags (including Open Graph) from a remote URL
A Node.js module to fetch HTML meta tags (including Open Graph) from a remote URL
npm install metaget --save
Promise:
const metaget = require('metaget');
try{
const metaResponse = await metaget.fetch('https://wordpress.com');
console.log('metaResponse', metaResponse);
}catch(ex){
console.log('Fail', ex);
}
Callback:
const metaget = require('metaget');
metaget.fetch('https://wordpress.com', (err, metaResponse) => {
if(err){
console.log(err);
}else{
console.log(metaResponse);
}
});
Response will be an Object containing all the meta tags from the URL. All tags are output in the example above. Some tags with illegal characters can be accessed by:
metaResponse['og:title'];
It's possible to set any HTTP headers in the request. This can be done by specifying them as options in the call. If no options are provided the only default header is a User-Agent of "request".
This is how you would specify a "User-Agent" of a Google Bot:
try{
const metaResponse = await metaget.fetch('https://wordpress.com', { headers: { 'User-Agent': 'Googlebot' } });
console.log('metaResponse', metaResponse);
}catch(ex){
console.log('Fail', ex);
}
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
FAQs
A Node.js module to fetch HTML meta tags (including Open Graph) from a remote URL
We found that metaget demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.