duck-duck-scrape
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -8,2 +8,5 @@ # Changelog | ||
## [Unreleased] | ||
## [2.2.1] - 2022-02-02 | ||
### Fixed: | ||
- Improved web safe search filter ([#33](https://github.com/Snazzah/duck-duck-scrape/issues/33)) | ||
## [2.2.0] - 2021-10-26 | ||
@@ -48,3 +51,3 @@ ### Added: | ||
[Unreleased]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.2.0...HEAD | ||
[Unreleased]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.2.1...HEAD | ||
[1.0.3]: https://github.com/Snazzah/duck-duck-scrape/releases/tag/v1.0.3 | ||
@@ -60,1 +63,2 @@ [2.0.0]: https://github.com/Snazzah/duck-duck-scrape/compare/v1.0.3...v2.0.0 | ||
[2.2.0]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.1.5...v2.2.0 | ||
[2.2.1]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.2.0...v2.2.1 |
@@ -43,3 +43,5 @@ "use strict"; | ||
q: query, | ||
...(options.safeSearch !== util_1.SafeSearchType.STRICT ? { t: 'D' } : {}), | ||
l: options.locale, | ||
...(options.safeSearch === util_1.SafeSearchType.STRICT ? { p: '1' } : {}), | ||
kl: options.region || 'wt-wt', | ||
@@ -52,10 +54,25 @@ s: String(options.offset), | ||
vqd, | ||
ex: String(options.safeSearch), | ||
...(options.safeSearch !== util_1.SafeSearchType.STRICT ? { ex: String(options.safeSearch) } : {}), | ||
sp: '1', | ||
bpa: '1', | ||
cdrexp: 'b', | ||
biaexp: 'b', | ||
msvrtexp: 'b' | ||
msvrtexp: 'b', | ||
...(options.safeSearch === util_1.SafeSearchType.STRICT | ||
? { | ||
videxp: 'a', | ||
nadse: 'b', | ||
eclsexp: 'a', | ||
stiaexp: 'a', | ||
tjsexp: 'b', | ||
related: 'b', | ||
msnexp: 'a' | ||
} | ||
: { | ||
nadse: 'b', | ||
eclsexp: 'b', | ||
tjsexp: 'b' | ||
// cdrexp: 'b' | ||
}) | ||
}; | ||
const response = await (0, needle_1.default)('get', `https://duckduckgo.com/d.js?${(0, util_1.queryString)(queryObject)}`, needleOptions); | ||
const response = await (0, needle_1.default)('get', `https://links.duckduckgo.com/d.js?${(0, util_1.queryString)(queryObject)}`, needleOptions); | ||
if (response.body.includes('DDG.deep.is506')) | ||
@@ -62,0 +79,0 @@ throw new Error('A server error occurred!'); |
@@ -70,4 +70,5 @@ import { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.1.0 | ||
* @returns The dns result | ||
*/ | ||
export declare function dns(domain: string, recordType?: DNSRecordType, needleOptions?: NeedleOptions): Promise<DNSResult>; |
@@ -57,2 +57,3 @@ "use strict"; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.1.0 | ||
* @returns The dns result | ||
@@ -59,0 +60,0 @@ */ |
@@ -43,4 +43,5 @@ import { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The emojipedia result | ||
*/ | ||
export declare function emojipedia(emoji: string, needleOptions?: NeedleOptions): Promise<EmojipediaResult>; |
@@ -16,2 +16,3 @@ "use strict"; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The emojipedia result | ||
@@ -18,0 +19,0 @@ */ |
@@ -20,4 +20,5 @@ import { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The expandUrl result | ||
*/ | ||
export declare function expandUrl(url: string, needleOptions?: NeedleOptions): Promise<ExpandUrlResult>; |
@@ -16,2 +16,3 @@ "use strict"; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The expandUrl result | ||
@@ -18,0 +19,0 @@ */ |
@@ -48,4 +48,5 @@ import { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The statista result | ||
*/ | ||
export declare function statista(query: string, needleOptions?: NeedleOptions): Promise<StatistaResult>; |
@@ -16,2 +16,3 @@ "use strict"; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The statista result | ||
@@ -18,0 +19,0 @@ */ |
@@ -22,4 +22,5 @@ import { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The thesaurus result | ||
*/ | ||
export declare function thesaurus(word: string, needleOptions?: NeedleOptions): Promise<ThesaurusResult | null>; |
@@ -16,2 +16,3 @@ "use strict"; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The thesaurus result | ||
@@ -18,0 +19,0 @@ */ |
{ | ||
"name": "duck-duck-scrape", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Search from DuckDuckGo and use it's spice APIs.", | ||
@@ -47,16 +47,16 @@ "main": "./lib/index.js", | ||
"@types/needle": "^2.5.1", | ||
"@types/node": "^16.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.2.0", | ||
"eslint": "7", | ||
"@types/node": "^17.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.3.0", | ||
"@typescript-eslint/parser": "^5.3.0", | ||
"eslint": "^8.1.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.0", | ||
"lint-staged": "^11.0.0", | ||
"lint-staged": "^12.0.2", | ||
"prettier": "^2.4.1", | ||
"ts-node": "^10.0.0", | ||
"typedoc": "^0.22.3", | ||
"typescript": "4.4", | ||
"typedoc": "0.21", | ||
"typescript": "4.5", | ||
"yarn": "^1.22.10" | ||
} | ||
} |
@@ -135,3 +135,5 @@ import needle, { NeedleOptions } from 'needle'; | ||
q: query, | ||
...(options.safeSearch !== SafeSearchType.STRICT ? { t: 'D' } : {}), | ||
l: options.locale!, | ||
...(options.safeSearch === SafeSearchType.STRICT ? { p: '1' } : {}), | ||
kl: options.region || 'wt-wt', | ||
@@ -144,8 +146,23 @@ s: String(options.offset), | ||
vqd, | ||
ex: String(options.safeSearch), | ||
...(options.safeSearch !== SafeSearchType.STRICT ? { ex: String(options.safeSearch) } : {}), | ||
sp: '1', | ||
bpa: '1', | ||
cdrexp: 'b', | ||
biaexp: 'b', | ||
msvrtexp: 'b' | ||
msvrtexp: 'b', | ||
...(options.safeSearch === SafeSearchType.STRICT | ||
? { | ||
videxp: 'a', | ||
nadse: 'b', | ||
eclsexp: 'a', | ||
stiaexp: 'a', | ||
tjsexp: 'b', | ||
related: 'b', | ||
msnexp: 'a' | ||
} | ||
: { | ||
nadse: 'b', | ||
eclsexp: 'b', | ||
tjsexp: 'b' | ||
// cdrexp: 'b' | ||
}) | ||
}; | ||
@@ -155,3 +172,3 @@ | ||
'get', | ||
`https://duckduckgo.com/d.js?${queryString(queryObject)}`, | ||
`https://links.duckduckgo.com/d.js?${queryString(queryObject)}`, | ||
needleOptions | ||
@@ -158,0 +175,0 @@ ); |
@@ -75,2 +75,3 @@ import needle, { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.1.0 | ||
* @returns The dns result | ||
@@ -77,0 +78,0 @@ */ |
@@ -47,2 +47,3 @@ import needle, { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The emojipedia result | ||
@@ -49,0 +50,0 @@ */ |
@@ -23,2 +23,3 @@ import needle, { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The expandUrl result | ||
@@ -25,0 +26,0 @@ */ |
@@ -53,2 +53,3 @@ import needle, { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The statista result | ||
@@ -55,0 +56,0 @@ */ |
@@ -26,2 +26,3 @@ import needle, { NeedleOptions } from 'needle'; | ||
* @param needleOptions The options for the HTTP request | ||
* @since v2.2.0 | ||
* @returns The thesaurus result | ||
@@ -28,0 +29,0 @@ */ |
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
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
154741
4296