duck-duck-scrape
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -8,2 +8,7 @@ # Changelog | ||
## [Unreleased] | ||
## [2.1.0] - 2021-06-03 | ||
### Added: | ||
- [DNS spice](https://duck-duck-scrape.js.org/modules.html#dns) | ||
### Fixed: | ||
- SearchTimeType is now exported to index | ||
## [2.0.1] - 2021-04-29 | ||
@@ -22,5 +27,6 @@ ### Fixed: | ||
[Unreleased]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.0.1...HEAD | ||
[Unreleased]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.1.0...HEAD | ||
[1.0.3]: https://github.com/Snazzah/duck-duck-scrape/releases/tag/v1.0.3 | ||
[2.0.0]: https://github.com/Snazzah/duck-duck-scrape/compare/v1.0.3...v2.0.0 | ||
[2.0.1]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.0.0...v2.0.1 | ||
[2.0.1]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.0.0...v2.0.1 | ||
[2.1.0]: https://github.com/Snazzah/duck-duck-scrape/compare/v2.0.0...v2.1.0 |
export { DuckbarImageResult } from './types'; | ||
export { SafeSearchType, getVQD } from './util'; | ||
export { SafeSearchType, SearchTimeType, getVQD } from './util'; | ||
export * from './search/search'; | ||
@@ -10,2 +10,3 @@ export * from './search/images'; | ||
export * from './spices/currency'; | ||
export * from './spices/dns'; | ||
export * from './spices/forecast'; | ||
@@ -12,0 +13,0 @@ export * from './spices/dictionary/definition'; |
@@ -13,5 +13,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVQD = exports.SafeSearchType = void 0; | ||
exports.getVQD = exports.SearchTimeType = exports.SafeSearchType = void 0; | ||
var util_1 = require("./util"); | ||
Object.defineProperty(exports, "SafeSearchType", { enumerable: true, get: function () { return util_1.SafeSearchType; } }); | ||
Object.defineProperty(exports, "SearchTimeType", { enumerable: true, get: function () { return util_1.SearchTimeType; } }); | ||
Object.defineProperty(exports, "getVQD", { enumerable: true, get: function () { return util_1.getVQD; } }); | ||
@@ -25,2 +26,3 @@ __exportStar(require("./search/search"), exports); | ||
__exportStar(require("./spices/currency"), exports); | ||
__exportStar(require("./spices/dns"), exports); | ||
__exportStar(require("./spices/forecast"), exports); | ||
@@ -27,0 +29,0 @@ __exportStar(require("./spices/dictionary/definition"), exports); |
@@ -93,2 +93,13 @@ import { NeedleOptions } from 'needle'; | ||
} | ||
/** An auto-complete bang. */ | ||
export interface AutocompleteBang { | ||
/** The image of the bang */ | ||
image: string; | ||
/** The prefix of the bang. */ | ||
phrase: string; | ||
score: number; | ||
/** The title of the bang. */ | ||
snippet: string; | ||
} | ||
export declare type AutocompleteResult = AutocompleteTerm | AutocompleteBang; | ||
/** | ||
@@ -102,2 +113,2 @@ * Get auto-complete terms from a query. | ||
*/ | ||
export declare function autocomplete(query: string, region?: string, needleOptions?: NeedleOptions): Promise<AutocompleteTerm[]>; | ||
export declare function autocomplete(query: string, region?: string, needleOptions?: NeedleOptions): Promise<AutocompleteResult[]>; |
{ | ||
"name": "duck-duck-scrape", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Search from DuckDuckGo and use it's spice APIs.", | ||
@@ -54,5 +54,5 @@ "main": "./lib/index.js", | ||
"husky": "^6.0.0", | ||
"lint-staged": "^10.5.4", | ||
"lint-staged": "^11.0.0", | ||
"prettier": "^2.2.1", | ||
"ts-node": "^9.1.1", | ||
"ts-node": "^10.0.0", | ||
"typedoc": "^0.20.35", | ||
@@ -59,0 +59,0 @@ "typescript": "^4.1.3", |
export { DuckbarImageResult } from './types'; | ||
export { SafeSearchType, getVQD } from './util'; | ||
export { SafeSearchType, SearchTimeType, getVQD } from './util'; | ||
@@ -12,2 +12,3 @@ export * from './search/search'; | ||
export * from './spices/currency'; | ||
export * from './spices/dns'; | ||
export * from './spices/forecast'; | ||
@@ -14,0 +15,0 @@ export * from './spices/dictionary/definition'; |
@@ -47,6 +47,10 @@ import needle, { NeedleOptions } from 'needle'; | ||
const SEARCH_REGEX = /DDG\.pageLayout\.load\('d',(\[.+\])\);DDG\.duckbar\.load\('images'/; | ||
const IMAGES_REGEX = /;DDG\.duckbar\.load\('images', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('news/; | ||
const NEWS_REGEX = /;DDG\.duckbar\.load\('news', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('videos/; | ||
const VIDEOS_REGEX = /;DDG\.duckbar\.load\('videos', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.loadModule\('related_searches/; | ||
const RELATED_SEARCHES_REGEX = /DDG\.duckbar\.loadModule\('related_searches', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('products/; | ||
const IMAGES_REGEX = | ||
/;DDG\.duckbar\.load\('images', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('news/; | ||
const NEWS_REGEX = | ||
/;DDG\.duckbar\.load\('news', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('videos/; | ||
const VIDEOS_REGEX = | ||
/;DDG\.duckbar\.load\('videos', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.loadModule\('related_searches/; | ||
const RELATED_SEARCHES_REGEX = | ||
/DDG\.duckbar\.loadModule\('related_searches', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('products/; | ||
@@ -310,2 +314,15 @@ /** | ||
/** An auto-complete bang. */ | ||
export interface AutocompleteBang { | ||
/** The image of the bang */ | ||
image: string; | ||
/** The prefix of the bang. */ | ||
phrase: string; | ||
score: number; | ||
/** The title of the bang. */ | ||
snippet: string; | ||
} | ||
export type AutocompleteResult = AutocompleteTerm | AutocompleteBang; | ||
/** | ||
@@ -323,3 +340,3 @@ * Get auto-complete terms from a query. | ||
needleOptions?: NeedleOptions | ||
): Promise<AutocompleteTerm[]> { | ||
): Promise<AutocompleteResult[]> { | ||
if (!query) throw new Error('Query cannot be empty!'); | ||
@@ -326,0 +343,0 @@ |
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
135818
52
3787