Comparing version 1.0.8 to 1.0.9
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -31,3 +30,3 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
GetCheerioInstance = async () => { | ||
async GetCheerioInstance(){ | ||
let Endpoint = `https://search.aol.com/aol/search?q=${this.Query}&b=${(this.Page - 1) * 10}`; | ||
@@ -42,9 +41,10 @@ if(this.Type === 'Images') | ||
ExtractResultStats = (CheerioInstance) => | ||
(CheerioInstance('.fz-13').map((Index, Element) => { | ||
let Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[0]; | ||
return Results; | ||
})); | ||
ExtractResultStats(CheerioInstance){ | ||
return (CheerioInstance('.fz-13').map((Index, Element) => { | ||
const Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[0]; | ||
return Results; | ||
})); | ||
} | ||
Images = async () => { | ||
async Images(){ | ||
this.Type = 'Images'; | ||
@@ -67,3 +67,3 @@ const $ = await this.GetCheerioInstance(); | ||
Videos = async () => { | ||
async Videos(){ | ||
this.Type = 'Videos'; | ||
@@ -86,3 +86,3 @@ const $ = await this.GetCheerioInstance(); | ||
Search = async () => { | ||
async Search(){ | ||
const $ = await this.GetCheerioInstance(); | ||
@@ -89,0 +89,0 @@ const TotalIndexedResults = this.ExtractResultStats($)[0]; |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -30,12 +29,15 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
ExtractResultStats = (CheerioInstance) => | ||
(CheerioInstance('.PartialResultsHeader-summary').map((Index, Element) => { | ||
let Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[2]; | ||
ExtractResultStats(CheerioInstance){ | ||
return (CheerioInstance('.PartialResultsHeader-summary').map((_, Element) => { | ||
const Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[2]; | ||
return Results; | ||
})); | ||
GetCheerioInstance = async () => Cheerio.load(( | ||
await Axios.get(`https://www.ask.com/web?o=0&l=dir&qo=pagination&q=${this.Query}&qsrc=998&page=${this.Page}`, kAxiosOptions)).data); | ||
Search = async () => { | ||
} | ||
async GetCheerioInstance(){ | ||
return Cheerio.load(( | ||
await Axios.get(`https://www.ask.com/web?o=0&l=dir&qo=pagination&q=${this.Query}&qsrc=998&page=${this.Page}`, kAxiosOptions)).data); | ||
} | ||
async Search(){ | ||
const $ = await this.GetCheerioInstance(); | ||
@@ -42,0 +44,0 @@ const TotalIndexedResults = this.ExtractResultStats($)[0]; |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -32,4 +31,4 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
ExtractResultStats = (CheerioInstance) => | ||
(CheerioInstance('#result-stats').map((Index, Element) => { | ||
ExtractResultStats(CheerioInstance){ | ||
return (CheerioInstance('#result-stats').map((Index, Element) => { | ||
// ! Do it better | ||
@@ -43,11 +42,14 @@ let [Results, Timeout] = CheerioInstance(Element).text().split('('); | ||
})); | ||
} | ||
GetCheerioInstance = async () => Cheerio.load(( | ||
await Axios.get(`https://www.google.com/search?q=${this.Query}&start=${(this.Page - 1) * 10}&hl=${this.Language}&tbm=${this.Type}`, kAxiosOptions)).data); | ||
async GetCheerioInstance(){ | ||
return Cheerio.load(( | ||
await Axios.get(`https://www.google.com/search?q=${this.Query}&start=${(this.Page - 1) * 10}&hl=${this.Language}&tbm=${this.Type}`, kAxiosOptions)).data); | ||
} | ||
Search = async () => { | ||
async Search(){ | ||
const $ = await this.GetCheerioInstance(); | ||
const [TotalIndexedResults, SearchTimeout] = this.ExtractResultStats($); | ||
const Buffer = { Links: [], Titles: [], Descriptions: [] }; | ||
$('.yuRUbf a').each((Index, Element) => Buffer.Links[Index] = $(Element).attr('href')); | ||
$('.yuRUbf > div > a').each((Index, Element) => Buffer.Links[Index] = $(Element).attr('href')); | ||
$('.yuRUbf h3').each((Index, Element) => Buffer.Titles[Index] = $(Element).text()); | ||
@@ -66,3 +68,3 @@ $('.VwiC3b').each((Index, Element) => Buffer.Descriptions[Index] = $(Element).text().trim()); | ||
News = async () => { | ||
async News(){ | ||
this.Type = 'nws'; | ||
@@ -91,3 +93,3 @@ const $ = await this.GetCheerioInstance(); | ||
Videos = async () => { | ||
async Videos(){ | ||
this.Type = 'vid'; | ||
@@ -116,3 +118,3 @@ const $ = await this.GetCheerioInstance(); | ||
Shopping = async () => { | ||
async Shopping(){ | ||
this.Type = 'shop'; | ||
@@ -135,3 +137,3 @@ const $ = await this.GetCheerioInstance(); | ||
Books = async () => { | ||
async Books(){ | ||
this.Type = 'bks'; | ||
@@ -138,0 +140,0 @@ const $ = await this.GetCheerioInstance(); |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -29,6 +28,8 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
GetCheerioInstance = async () => Cheerio.load(( | ||
await Axios.get(`https://www.qwant.com/?t=images&q=${this.Query}`, kAxiosOptions)).data); | ||
async GetCheerioInstance(){ | ||
return Cheerio.load(( | ||
await Axios.get(`https://www.qwant.com/?t=images&q=${this.Query}`, kAxiosOptions)).data); | ||
} | ||
Images = async () => { | ||
async Images(){ | ||
const $ = await this.GetCheerioInstance(); | ||
@@ -35,0 +36,0 @@ const Buffer = { Titles: [], Images: [], Sources: [] }; |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -28,3 +27,3 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
Wiki = async () => { | ||
async Wiki(){ | ||
await WikipediaRestAPI.setLang(this.Language); | ||
@@ -31,0 +30,0 @@ const Data = await WikipediaRestAPI.page(this.Query); |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -32,10 +31,11 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
ExtractResultStats = (CheerioInstance) => | ||
(CheerioInstance('.searchSuperTop').map((Index, Element) => { | ||
ExtractResultStats(CheerioInstance){ | ||
return (CheerioInstance('.searchSuperTop').map((Index, Element) => { | ||
// ! Do it better | ||
let Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[0]; | ||
const Results = CheerioInstance(Element).text().replaceAll(',', '').replaceAll('.', '').match(/\d+/g)[0]; | ||
return Results; | ||
})); | ||
} | ||
GetCheerioInstance = async () => { | ||
async GetCheerioInstance(){ | ||
let Endpoint = `https://search.yahoo.com/search?q=${this.Query}&ei=UTF-8&nojs=1&b=${(this.Page - 1) * 10}`; | ||
@@ -51,3 +51,3 @@ if(this.Type === 'Video') | ||
Search = async () => { | ||
async Search(){ | ||
const $ = await this.GetCheerioInstance(); | ||
@@ -70,3 +70,3 @@ const TotalIndexedResults = this.ExtractResultStats($)[0]; | ||
Videos = async () => { | ||
async Videos(){ | ||
this.Type = 'Video'; | ||
@@ -87,3 +87,3 @@ const $ = await this.GetCheerioInstance(); | ||
News = async () => { | ||
async News(){ | ||
this.Type = 'News'; | ||
@@ -113,3 +113,3 @@ const $ = await this.GetCheerioInstance(); | ||
Shopping = async () => { | ||
async Shopping(){ | ||
this.Type = 'Shopping'; | ||
@@ -116,0 +116,0 @@ const $ = await this.GetCheerioInstance(); |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -14,0 +13,0 @@ * -> https://github.com/codewithrodi/CodexDrake/ |
14
index.js
@@ -10,4 +10,3 @@ /*** | ||
* | ||
* CDrake-SE: Open source, ridiculously fast search engine capable of self-hosting built | ||
* solely with JavaScript and doses of Modafinil. | ||
* CDrake-SE: Efficient and fast open source search engine built on JavaScript capable of self-hosting. | ||
* | ||
@@ -25,2 +24,3 @@ * -> https://github.com/codewithrodi/CodexDrake/ | ||
const AskEngine = require('./Engines/Ask'); | ||
const BingEngine = require('./Engines/Bing'); | ||
const SuggestEngine = require('./Engines/Suggest'); | ||
@@ -32,2 +32,3 @@ const WikipediaEngine = require('./Engines/Wikipedia'); | ||
const Instances = { | ||
Bing: new BingEngine(Arguments), | ||
Google: new GoogleEngine(Arguments), | ||
@@ -61,2 +62,3 @@ Yahoo: new YahooEngine(Arguments), | ||
return await Promise.any([ | ||
Instances.Bing.Search(), | ||
Instances.Google.Search(), | ||
@@ -73,4 +75,10 @@ Instances.Aol.Search(), | ||
]) | ||
else if(['News', 'Shopping'].includes(Method)) | ||
else if('News' === Method) | ||
return await Promise.any([ | ||
Instances.Google.News(), | ||
Instances.Yahoo.News(), | ||
Instances.Bing.News() | ||
]); | ||
else if('Shopping' === Method) | ||
return await Promise.any([ | ||
Instances.Google[Method](), | ||
@@ -77,0 +85,0 @@ Instances.Yahoo[Method]() |
{ | ||
"name": "cdrake-se", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "A library that will make your life easier when you want to search the internet, not pay APIs, search from your computer for free!", | ||
@@ -5,0 +5,0 @@ "author": "Rodolfo Herrera Hernandez @codewithrodi", |
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
77114
29
1085