Package Exports
- google-sr
- google-sr/dist/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 (google-sr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
google-sr 🔍
Simple & Fast Package for scraping Google search results without the need for an API key. 🚀
View documentation here
Features ✨
- Lightweight 💨
- Simple & Fast ⚡️ *
- Well tested 🔄
- TypeScript compatible 🧑💻
* depends on amount of pages fetched and host internet speed (avg of 500ms per page in testing )
Install 📦
To get started, you can install google-sr using your preferred package manager:
# npm
npm install google-sr
# pnpm
pnpm add google-sr
# yarn
yarn add google-sr
Usage
Simple example
You can easily perform a single-page search like this:
import { search } from 'google-sr';
search({ query: 'nodejs' }).then(console.log);
// or if using await/async
const searchResults = await search({ query: 'nodejs' });
console.log(searchResults);More detailed examples & usage can be found here
Important Notes 🚨
- google-sr scrapes the HTML of Google search results. This means it relies on Google's predefined HTML structure. If Google changes this structure, the package might seem to behave unexpectedly. To avoid this, it's best to keep your package updated to the latest version. (Note: we may take time to update it to any new structure)
View current selectors here
- Fetching multiple pages can be slow, we recommended either fetching only small amount (i.e 5 max) or fetching pages in chunks as needed using specific page control of
searchWithPagesfunction
Tests
Tests are written using mocha and can be run by using the test script
# npm
npm run test
# pnpm
pnpm run test
# yarn
yarn run test
Support & Bug Reporting 🛠️🐞
Make sure you are on the latest version before creating bug reports
Support and bug reporting both can be done on either my discord server or on github issues
License
This repository and the code inside it is licensed under the Apache-2.0 License. Read LICENSE for more information.