{"id":21197937,"url":"https://github.com/jonstuebe/scraper","last_synced_at":"2025-10-24T00:31:57.062Z","repository":{"id":25951075,"uuid":"106963718","full_name":"jonstuebe/scraper","owner":"jonstuebe","description":"Node.js based scraper using headless chrome","archived":false,"fork":false,"pushed_at":"2022-12-08T19:09:48.000Z","size":321,"stargazers_count":46,"open_issues_count":11,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-09T03:17:40.046Z","etag":null,"topics":["javascript","nodejs","scraper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonstuebe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-14T21:19:29.000Z","updated_at":"2023-12-25T13:16:51.000Z","dependencies_parsed_at":"2022-08-07T11:16:13.246Z","dependency_job_id":null,"html_url":"https://github.com/jonstuebe/scraper","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonstuebe%2Fscraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonstuebe%2Fscraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonstuebe%2Fscraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonstuebe%2Fscraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonstuebe","download_url":"https://codeload.github.com/jonstuebe/scraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225622935,"owners_count":17498168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","scraper"],"created_at":"2024-11-20T19:47:02.112Z","updated_at":"2025-10-24T00:31:52.044Z","avatar_url":"https://github.com/jonstuebe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scraper\n\nNode.js based scraper using headless chrome\n\n[![version](https://img.shields.io/npm/v/@jonstuebe/scraper.svg?style=flat-square)](https://www.npmjs.com/package/@jonstuebe/scraper) [![dependecies](https://david-dm.org/jonstuebe/scraper.svg)](https://www.npmjs.com/package/@jonstuebe/scraper) [![build](https://travis-ci.org/jonstuebe/scraper.svg?branch=master)](https://www.npmjs.com/package/@jonstuebe/scraper)\n\n## Installation\n\n```bash\n$ npm install @jonstuebe/scraper\n```\n\n## Features\n\n- Scrape top ecommerce sites (Amazon, Walmart, Target)\n- Return basic product information (title, price, image, description)\n- Easy to use API to scrape any website\n\n## API\n\nSimply require the package and initialize with a url and pass a callback function to receive the data.\n\n#### es5\n\n```js\nconst Scraper = require(\"@jonstuebe/scraper\");\n\n// run inside of an async function\n(async () =\u003e {\n  const data = await Scraper.scrapeAndDetect(\n    \"http://www.amazon.com/gp/product/B00X4WHP5E/\"\n  );\n  console.log(data);\n})();\n```\n\n#### es6\n\n```js\nimport Scraper from \"@jonstuebe/scraper\";\n\n// run inside of an async function\n(async () =\u003e {\n  const data = await Scraper(\"http://www.amazon.com/gp/product/B00X4WHP5E/\");\n  console.log(data);\n})();\n```\n\n#### with promises\n\n```js\nimport Scraper from \"@jonstuebe/scraper\";\n\nScraper(\"http://www.amazon.com/gp/product/B00X4WHP5E/\").then(data =\u003e {\n  console.log(data);\n});\n```\n\n#### shared scraper instance\n\nIf you are going to be running the scraper a number of times in succession, it's recommended to share the same chromium instance for each sequential/parallel scrape.\n\n```js\nimport puppeteer from \"puppeteer\";\nimport Scraper from \"@jonstuebe/scraper\";\n\n// run inside of an async function\n(async () =\u003e {\n  const browser = await puppeteer.launch();\n  let products = [\n    \"https://www.target.com/p/corinna-angle-leg-side-table-wood-threshold-8482/-/A-53496420\",\n    \"https://www.target.com/p/glasgow-metal-end-table-black-project-62-8482/-/A-52343433\"\n  ];\n\n  let productsData = [];\n  for (const product of products) {\n    const productData = await Scraper(product, browser);\n    productsData.push(productData);\n  }\n\n  await browser.close(); // make sure and close the browser otherwise the instances will continue to run in the backround on your machine\n\n  console.table(productsData);\n})();\n```\n\n#### emulate devices\n\nIf you want to emulate a device, pass in a puppeteer device as the third agument:\n\n```js\nimport puppeteer from \"puppeteer\";\nimport Scraper from \"@jonstuebe/scraper\";\n\n// run inside of an async function\n(async () =\u003e {\n  const data = await Scraper(\n    \"http://www.amazon.com/gp/product/B00X4WHP5E/\",\n    null,\n    puppeteer.devices[\"iPhone SE\"]\n  );\n  console.log(data);\n})();\n```\n\n#### custom scrapers\n\n```js\nconst Scraper = require(\"@jonstuebe/scraper\");\n\n(async () =\u003e {\n  const site = {\n    name: \"npm\",\n    hosts: [\"www.npmjs.com\"],\n    scrape: async page =\u003e {\n      const name = await Scraper.getText(\"div.content-column \u003e h1 \u003e a\", page);\n      const version = await Scraper.getText(\n        \"div.sidebar \u003e ul:nth-child(2) \u003e li:nth-child(2) \u003e strong\",\n        page\n      );\n      const author = await Scraper.getText(\n        \"div.sidebar \u003e ul:nth-child(2) \u003e li.last-publisher \u003e a \u003e span\",\n        page\n      );\n\n      return {\n        name,\n        version,\n        author\n      };\n    }\n  };\n\n  const data = await Scraper.scrape(\n    \"https://www.npmjs.com/package/lodash\",\n    site\n  );\n  console.log(data);\n})();\n```\n\n## Contributing\n\nIf you want to add any sites, or just have an idea or feature, go ahead and fork [this repo](https://github.com/jonstuebe/scraper/) and send me a pull request. I'll be happy to take a look when I can and get back to you.\n\n## Issues\n\nFor any and all issues/bugs, please post a description and code sample to reproduce the problem on the [issues page](https://github.com/jonstuebe/scraper/issues).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonstuebe%2Fscraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonstuebe%2Fscraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonstuebe%2Fscraper/lists"}