Comparing version 2.0.0 to 3.0.0
{ | ||
"name": "google-sr", | ||
"version": "2.0.0", | ||
"description": "Yet another library to do google searches, easy and simple", | ||
"version": "3.0.0", | ||
"description": "Fast and efficient Package for scraping Google search results without the need for an API key", | ||
"repository": "typicalninja493/google-sr", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"axios": "^0.26.0", | ||
"cheerio": "^1.0.0-rc.10" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"homepage": "https://typicalninja493.github.io/google-sr/", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"keywords": [ | ||
@@ -23,3 +17,21 @@ "google-sr", | ||
"author": "typicalninja493", | ||
"license": "MIT" | ||
} | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"axios": "^1.4.0", | ||
"cheerio": "1.0.0-rc.12", | ||
"deepmerge-ts": "^5.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.5", | ||
"@types/mocha": "^10.0.1", | ||
"chai": "^4.3.7", | ||
"mocha": "^10.2.0", | ||
"ts-node": "^10.9.1", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
"scripts": { | ||
"test": "mocha --require ts-node/register tests/*.ts", | ||
"build": "tsup" | ||
} | ||
} |
107
README.md
@@ -1,66 +0,91 @@ | ||
## Google-sr | ||
# google-sr 🔍 | ||
Yet another library to do google searches. | ||
Fast and efficient Package for scraping Google search results without the need for an API key. 🚀 | ||
Below is a simple example of using this package | ||
> View documentation [here](https://typicalninja493.github.io/google-sr/) | ||
## Install | ||
## Features ✨ | ||
``` | ||
* Lightweight 💨 | ||
* Fast and efficient ⚡️ * | ||
* Well tested 🔄 | ||
* TypeScript compatible 🧑💻 | ||
> \* depends on amount of pages fetched (avg of 1s per page in testing) | ||
## Install 📦 | ||
To get started, you can install **google-sr** using your preferred package manager: | ||
```bash | ||
# npm | ||
npm install google-sr | ||
``` | ||
* Typescript and Javascript compatible | ||
# pnpm | ||
## Usage | ||
pnpm add google-sr | ||
#### with `.then` | ||
##### Without safe mode | ||
```ts | ||
import search from 'google-sr' | ||
# yarn | ||
search('node.js', { safeMode: false }).then(r => console.log(r)) | ||
yarn add google-sr | ||
``` | ||
##### With safe mode | ||
# Usage | ||
### Simple example | ||
You can easily perform a single-page search like this: | ||
```ts | ||
import search from 'google-sr' | ||
import { search } from 'google-sr'; | ||
search('node.js').then(r => console.log(r)) | ||
search({ query: 'nodejs' }).then(console.log); | ||
// or if using await/async | ||
const searchResults = await search({ query: 'nodejs' }); | ||
console.log(searchResults); | ||
``` | ||
### With async/await | ||
> More detailed examples & usage can be found [here](https://typicalninja493.github.io/google-sr#usage) | ||
```ts | ||
import search from 'google-sr' | ||
// use an iife to use await | ||
(async () => { | ||
const result = await search('node.js') | ||
console.log(result) | ||
// search('node.js', { safeMode: false }) for without safe mode | ||
})() | ||
``` | ||
## Important Notes 🚨 | ||
### Available options | ||
* 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) | ||
* Page - default:- **1** | ||
* Selectors - { | ||
`DescriptionSelector`, | ||
`linkSelector`, | ||
`TitleSelector` | ||
} - default: `DefaultSelectors` | ||
* safeMode - default :- `true` | ||
selectors default - | ||
* DescriptionSelector - `#main > div > div > div > div:not(.v9i61e) > div.AP7Wnd` | ||
* linkSelector - `div.ZINbbc > div:nth-child(1) > a` | ||
* TitleSelector - `div.ZINbbc > div:nth-child(1) > a > h3` | ||
> View current selectors [here](https://typicalninja493.github.io/google-sr/selectors) | ||
# Support | ||
* 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 `searchWithPages` function | ||
Join my discord server for support: [discord](https://discord.gg/9s52pz6nWX) | ||
# Tests | ||
Tests are written using [mocha](https://mochajs.org/) and can be run by using the `test` script | ||
```bash | ||
# 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](https://discord.gg/9s52pz6nWX) or on [github issues](https://github.com/typicalninja493/google-sr/issues) | ||
# License | ||
This repository and the code inside it is licensed under the MIT License. Read [LICENSE](https://github.com/typicalninja493/google-sr/blob/master/LICENSE) for more information. | ||
This repository and the code inside it is licensed under the Apache-2.0 License. Read [LICENSE](./LICENSE) for more information. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
34927
6
266
1
91
3
7
1
+ Addeddeepmerge-ts@^5.1.0
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcheerio@1.0.0-rc.12(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddeepmerge-ts@5.1.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedhtmlparser2@8.0.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removedaxios@0.26.1(transitive)
- Removedcheerio@1.0.0(transitive)
- Removedencoding-sniffer@0.2.0(transitive)
- Removedhtmlparser2@9.1.0(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedparse5-parser-stream@7.1.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedundici@6.21.0(transitive)
- Removedwhatwg-encoding@3.1.1(transitive)
- Removedwhatwg-mimetype@4.0.0(transitive)
Updatedaxios@^1.4.0
Updatedcheerio@1.0.0-rc.12