Site icon StackBlogger

Extract Metadata Information From URL | TypeScript

extract-metadata-from-url-typescript-javascript

Metadata of a website holds the information about its search engine-related properties like title, description, site-name, site-color, and many other open-graph properties. If you are building a SEO service-related application then reading metadata properties of websites might be a required point for you. The article provides a very easy-to-use package that you can use in TypeScript/JavaScript project to extract metadata information from an URL.

Extract Metadata Information from URL

Extract metadata information from any http/https url.

Install link-meta-extractor package

Run the command to install the package in your existing TypeScript/JavaScript application. You can find the complete package here. Check the complete source code of the package here.

TypeScript Usage

Work with async/await

If you want to extract metadata information from a website using async/await then go with the following code…

Work with promise/callback

If you want to extract metadata information from a website using the callback method then go with the following code…

JavaScript Usage

Use the following code to extract metadata information from an url in JavaScript code

Work with async/await

If you want to extract metadata information from a website using async/await then go with the following code…

Work with promise/callback

If you want to extract metadata information from a website using the callback method then go with the following code…

Additional Metadata Fields Extraction

The plugin accepts additional fields as optional arguments that you can use to extract from a website.

Pass the meta field keys in string format as a rest parameter in the function. Refer to the code here…

Final Say