Microlink × Canocopy

Interact with
canopy.co

canopy.js
const mql = require('@microlink/mql')

const canopy = (url, opts) =>
  mql(url, {
    prerender: true,
    data: {
      products: {
        selectorAll: '.product-card',
        attr: {
          title: {
            type: 'title',
            selector: '.product-details-name',
            attr: 'text'
          },
          url: {
            type: 'url',
            selector: '.product-link-tracking',
            attr: 'href'
          },
          amazonUrl: {
            type: 'url',
            selector: '.card-buy-button',
            attr: 'href'
          },
          image: {
            type: 'img',
            selector: '.product-card-image img',
            attr: 'src'
          },
          brand: {
            type: 'title',
            selector: '.product-details-brand',
            attr: 'text'
          }
        }
      }
    },
    ...opts
  })

const result = await canopy('https://canopy.co/shop/everyday-carry')

mql.render(result)