This parser based on url-metadata module. Also used chardet and iconv-lite for encoding characters, sharp for image conversion, nodemon for local development.
Either through cloning with git or by using npm (the recommended way):
npm install --save link-metadata-parser
and use in code:
var linkMetadata = require('link-metadata-parser');
/**
* Also you can pass all options from
* https://github.com/LevelNewsOrg/url-metadata/#options
*/
var options = {
encodeImage: false,
maxImageWidth: 0
};
linkMetadata(link, options).then(
(meta) => console.log(meta),
(err) => console.log(err)
);
Repository already contains server example:
npm run server
and it can be running inside Docker:
docker build -t metadata:latest -f ./example/Dockerfile .
docker run -d -p 8080:8080 --name link-metadata-parser metadata:latest
npm run develop