Scraping URL metadata with an NPM package in a Node.js code step

Scraping URL metadata with an NPM package in a Node.js code step

Not only can you write custom code in Pipedream workflows, but you can install and use any NPM package as well. We'll use metadata-scraper in this episode.

Scraping a URL's metadata with a low code Node.js step

The Node.js code

You can copy & paste this code sample below into a brand new Node.js code step:

import getMetaData from 'metadata-scraper';

// To use previous step data, pass the `steps` object to the run() function
export default defineComponent({
  props: {
    url: {
      type: 'string',
      label: "URL to scrape metadata from",
    }
  },
  async run({ steps, $ }) {
    return await getMetaData(this.url)
  },
}