{"id":16357796,"url":"https://github.com/pevers/images-scraper","last_synced_at":"2025-04-14T18:17:59.580Z","repository":{"id":37883768,"uuid":"46666133","full_name":"pevers/images-scraper","owner":"pevers","description":"Simple and fast scraper for Google","archived":false,"fork":false,"pushed_at":"2024-10-10T07:15:31.000Z","size":481,"stargazers_count":236,"open_issues_count":7,"forks_count":74,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-14T18:17:54.625Z","etag":null,"topics":["google","images","nodejs","puppeteer","scraper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pevers.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-22T15:21:12.000Z","updated_at":"2025-04-09T16:55:03.000Z","dependencies_parsed_at":"2024-10-25T01:54:12.153Z","dependency_job_id":null,"html_url":"https://github.com/pevers/images-scraper","commit_stats":{"total_commits":154,"total_committers":18,"mean_commits":8.555555555555555,"dds":0.2142857142857143,"last_synced_commit":"145f494035e64f06043f9ba2cf69029a1fa173a1"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pevers%2Fimages-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pevers%2Fimages-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pevers%2Fimages-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pevers%2Fimages-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pevers","download_url":"https://codeload.github.com/pevers/images-scraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933350,"owners_count":21185461,"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":["google","images","nodejs","puppeteer","scraper"],"created_at":"2024-10-11T02:04:08.830Z","updated_at":"2025-04-14T18:17:59.551Z","avatar_url":"https://github.com/pevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# images-scraper\n\nSimple NPM package to scrape Google images using Puppeteer. The headless browser will behave as a 'normal' user and scrolls to the bottom of the page until there are enough results.\n\n**Please note that this is not an ideal approach to scrape images. It is only a demonstration to scrape images from Google.\nIf you don't care about the source, it is probably better to use a different search engine with an API, such as Bing.**\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://media.giphy.com/media/WSqsRhuPWPTrYtXAiN/giphy.gif\"\u003e\n\u003c/p\u003e\n\n# Installation\n\n`npm install images-scraper`\n\n# Example\n\nGive me the first 200 images of Banana's from Google (using headless browser)\n\n```js\nvar Scraper = require('images-scraper');\n\nconst google = new Scraper({\n  puppeteer: {\n    headless: true,\n  },\n});\n\n(async () =\u003e {\n  const results = await google.scrape('banana', 200);\n  console.log('results', results);\n})();\n```\n\n## Results\n\n`node src/example.js`\n\n```js\nresults [\n  {\n    url: 'https://api.time.com/wp-content/uploads/2019/11/gettyimages-459761948.jpg?quality=85\u0026crop=0px%2C74px%2C1024px%2C536px\u0026resize=1200%2C628\u0026strip',\n    source: 'https://time.com/5730790/banana-panama-disease/',\n    title: 'What We Can Learn From the Near-Extinction of Bananas | Time'\n  },\n  ...\n]\n```\n\n# Example 2 Using an array in a single browser instance (save resources)\n\nGive me the first 200 images of the following array of strings from Google (using headless browser)\n\n```js\nvar Scraper = require('images-scraper');\n\nconst google = new Scraper({\n  puppeteer: {\n    headless: false,\n  },\n});\n\nvar fruits = ['banana', 'tomato', 'melon', 'strawberry'](async () =\u003e {\n  const results = await google.scrape(fruits, 200);\n  console.log('results', results);\n})();\n```\n\n## Results when using an array\n\n`node src/example.js`\n\n```js\nresults[\n  {\n    query: '\u003cYour query string\u003e',\n    images: [\n      {\n        url: 'https://api.time.com/wp-content/uploads/2019/11/gettyimages-459761948.jpg?quality=85\u0026crop=0px%2C74px%2C1024px%2C536px\u0026resize=1200%2C628\u0026strip',\n        source: 'https://time.com/5730790/banana-panama-disease/',\n        title: 'What We Can Learn From the Near-Extinction of Bananas | Time',\n      },\n    ],\n  }\n];\n```\n\n# Options\n\nThere are multiple options that can be passed to the constructor.\n\n```js\nvar options = {\n  userAgent: 'Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0', // the user agent\n  puppeteer: {}, // puppeteer options, for example, { headless: false }\n  tbs: {  // every possible tbs search option, some examples and more info: http://jwebnet.net/advancedgooglesearch.html\n    isz:  // options: l(arge), m(edium), i(cons), etc.\n    itp:  // options: clipart, face, lineart, news, photo\n    ic:   // options: color, gray, trans\n    sur:  // options: fmc (commercial reuse with modification), fc (commercial reuse), fm (noncommercial reuse with modification), f (noncommercial reuse)\n  },\n  safe: false   // enable/disable safe search\n};\n```\n\n# Repl.it\n\nExample to fork: https://repl.it/join/hylyxvxc-peterevers\n\nRunning this on Repl.it requires you to create a Bash repl instead of a NodeJS repl. Creating a Bash repl will provide you the Chromium dependency.\n\n# Heroku\n\nTo use this packages on Heroku, install https://elements.heroku.com/buildpacks/jontewks/puppeteer-heroku-buildpack .\nThen run.\n\n```\nnpm config set puppeteer_download_host=https://npm.taobao.org/mirrors\n```\n\nAnd reinstall Puppeteer.\n\n# Debugging\n\nDebugging can be done by disabling the headless browser and visually inspect the actions taken.\n\n```js\nconst google = new Scraper({\n  puppeteer: {\n    headless: false,\n  },\n});\n```\n\nOr by settings the environment variable `LOG_LEVEL`.\n\n`LOG_LEVEL=debug node src/example.js`.\n\n# License\n\nCopyright (c) 2021, Peter Evers \u003cpevers90@gmail.com\u003e\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpevers%2Fimages-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpevers%2Fimages-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpevers%2Fimages-scraper/lists"}