Package Exports
- @backyboy/metascraper-shopping
- @backyboy/metascraper-shopping/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@backyboy/metascraper-shopping) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
metascraper-shopping
A custom rule bundle for @microlinkhq/metascraper to get product information from HTML markup on merchant websites
Install
$ npm install @samirrayani/metascraper-shopping --save
Usage
'use strict'
const metascraper = require('metascraper')([
require('@samirrayani/metascraper-shopping')(),
require('metascraper-title')(),
require('metascraper-image')(),
require('metascraper-url')()
]);
const got = require('got');
const goShopping = async () => {
const targetUrl = '<an URL from any e-commerce website>';
const { body: html, url } = await got(targetUrl);
const metadata = await metascraper({ html, url });
console.log(metadata);
};
goShopping();
/*
metadata: {
title: [String]
image: [String]
url: [String]
price: [Float]
currency: [String]
condition: [String]
sku: [String]
mpn: [String]
availability: [String]
asin: [String]
}
*/
License
@samirrayani/metascraper-shopping © 2019 Samir Rayani, Released under the MIT License.