Comparing version 1.0.2 to 1.0.3
15
index.js
@@ -7,5 +7,5 @@ const cheerio = require('cheerio') | ||
const DescriptionSelector = '#main > div > div > div > div:not(.v9i61e) > div.AP7Wnd' | ||
const linkSelector = 'div.ZINbbc > div:nth-child(1) > a' | ||
const TitleSelector = 'div.ZINbbc > div:nth-child(1) > a > h3' | ||
let DescriptionSelector = '#main > div > div > div > div:not(.v9i61e) > div.AP7Wnd' | ||
let linkSelector = 'div.ZINbbc > div:nth-child(1) > a' | ||
let TitleSelector = 'div.ZINbbc > div:nth-child(1) > a > h3' | ||
@@ -17,5 +17,11 @@ | ||
query: query, | ||
safeMode: options.safe ? options.safe !== 'active' ? false : 'active' : options.safe !== false ? 'active' : 'false' | ||
safeMode: options.safe ? options.safe !== 'active' ? false : 'active' : options.safe !== false ? 'active' : 'false', | ||
page: options.page ? options.page : false | ||
} | ||
let URL = PrepareUrl(Poptions) | ||
if(options.selectors){ | ||
if(options.selectors.linkSelector) linkSelector = options.selectors.linkSelector | ||
if(options.selectors.DescriptionSelector) DescriptionSelector = options.selectors.DescriptionSelector | ||
if(options.selectors.TitleSelector) linkSelector = options.selectors.TitleSelector | ||
} | ||
const resp = await fetch(URL).then(r => r.text()) | ||
@@ -27,3 +33,2 @@ const $ = cheerio.load(resp); | ||
raw: resp, | ||
} | ||
@@ -30,0 +35,0 @@ |
{ | ||
"name": "google-sr", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Yet another library to do google a search, easy and simple", | ||
@@ -5,0 +5,0 @@ "repository": "typicalninja493/google-sr", |
@@ -37,4 +37,17 @@ ## Google-sr | ||
### Available options | ||
* Page - default:- **1** | ||
* Selectors - `DescriptionSelector`, `linkSelector`, `TitleSelector` | ||
* safe - 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` | ||
* selectors **MUST** be in the object options.selectors | ||
ex- options.selectors.DescriptionSelector = 'some-selector' | ||
# Support | ||
Join my discord server for support: [discord](https://discord.gg/9s52pz6nWX) |
@@ -18,3 +18,4 @@ const querystring = require('querystring') | ||
} | ||
if(options.safeMode == 'active') optionsForQueryString.safe = 'active' | ||
if(options.safeMode == 'active') optionsForQueryString.safe = 'active'; | ||
if(options.page !== false) optionsForQueryString.start = options.page; | ||
@@ -21,0 +22,0 @@ const url = URL + '?' + querystring.stringify(optionsForQueryString) |
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
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
4906
84
52
4