Comparing version 1.0.4 to 1.0.5
@@ -100,3 +100,3 @@ /*** | ||
Publisher: Buffer.Publishers[Index], | ||
PubslihedAt: Buffer.PublishedDates[Index] | ||
PublishedAt: Buffer.PublishedDates[Index] | ||
})) | ||
@@ -125,2 +125,2 @@ }; | ||
module.exports = YahooEngine; | ||
module.exports = YahooEngine; |
10
index.js
@@ -22,2 +22,3 @@ /*** | ||
const SuggestEngine = require('./Engines/Suggest'); | ||
const WikipediaEngine = require('./Engines/Wikipedia'); | ||
@@ -33,2 +34,3 @@ module.exports = async ({ Method, Query, Page = 1, Language = 'en-US' }) => { | ||
Ask: new AskEngine(Arguments), | ||
Wikipedia: new WikipediaEngine(Arguments) | ||
}; | ||
@@ -44,2 +46,10 @@ if(Method === 'Images') | ||
]); | ||
else if(Method === 'Wikipedia') | ||
return await Promise.any([ | ||
Instances.Wikipedia.Wiki() | ||
]); | ||
else if(Method === 'Wikipedia.Suggest') | ||
return await Promise.any([ | ||
Instances.Wikipedia.Suggest() | ||
]); | ||
else if(Method === 'Suggest') | ||
@@ -46,0 +56,0 @@ return await SuggestEngine(Query); |
{ | ||
"name": "cdrake-se", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"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!", | ||
@@ -23,4 +23,4 @@ "author": "Rodolfo Herrera Hernandez @codewithrodi", | ||
"books", | ||
"links", | ||
"internet", | ||
"wikipedia", | ||
"engine", | ||
"scraper", | ||
@@ -44,4 +44,7 @@ "cheerio", | ||
"cheerio": "^1.0.0-rc.10", | ||
"node-suggest": "^1.0.2" | ||
"i": "^0.3.7", | ||
"node-suggest": "^1.0.2", | ||
"npm": "^9.2.0", | ||
"wikipedia": "^2.0.0" | ||
} | ||
} |
@@ -423,2 +423,59 @@ # CDrake-SE | ||
``` | ||
##### Gathering information from a Wikipedia page or biography | ||
You can collect a lot of information by requesting a search of the Wikipedia databases, if this search exactly matches one it will return a ton of information that is organized inside an object, in case, there is no page in based on your search a { Status: 'Error' } will be returned. | ||
```javascript | ||
// ! Importing the library to perform the search | ||
const SearchEngine = require('cdrake-se'); | ||
// ! Creating an asynchronous function that will be executed | ||
// ! automatically when the script is initialized, which will | ||
// ! search for information and display it on the screen | ||
(async function(){ | ||
try{ | ||
const LinusTorvaldsWikipediaPage = await SearchEngine({ | ||
// ! We indicate the method, in this case Wikipedia <SEARCH> | ||
Method: 'Wikipedia', | ||
// ! We indicate the query, in this case Linus Torvalds to return us information related to Linus Torvalds | ||
Query: 'Linus Torvalds', | ||
// ! We indicate the language | ||
Language: 'en' | ||
}); | ||
console.log(LinusTorvaldsWikipediaPage); | ||
}catch(SearchRuntimeError){ | ||
// ! If an error occurs, we will display it in the terminal | ||
console.log(SearchRuntimeError); | ||
} | ||
}()); | ||
``` | ||
##### Using the Wikipedia suggestion engine. | ||
Apart from the search suggestion that the engine has, you can use the suggestion engine that Wikipedia has, so that you can obtain existing links within their respective databases to access them. | ||
```javascript | ||
// ! Importing the library to perform the search | ||
const SearchEngine = require('cdrake-se'); | ||
// ! Creating an asynchronous function that will be executed | ||
// ! automatically when the script is initialized, which will | ||
// ! search for information and display it on the screen | ||
(async function(){ | ||
try{ | ||
const ElonWikipediaSearchSuggests = await SearchEngine({ | ||
// ! We indicate the method, in this case Wikipedia Suggestion | ||
Method: 'Wikipedia.Suggest', | ||
// ! We indicate the query, in this case Elon to return us suggestions | ||
Query: 'Elon', | ||
// ! We indicate the language | ||
Language: 'en' | ||
}); | ||
console.log(ElonWikipediaSearchSuggests); | ||
}catch(SearchRuntimeError){ | ||
// ! If an error occurs, we will display it in the terminal | ||
console.log(SearchRuntimeError); | ||
} | ||
}()); | ||
``` | ||
### Contributions and future versions | ||
@@ -425,0 +482,0 @@ This library along with its real world usage example web service will continue to receive updates, improvements and bug fixes, I decided to make the engine that uses the codexdrake library search web service so that other developers can experiment with it, create better stuff and update them if they fucking want to, they can do whatever they want with the code. |
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
58308
13
631
484
6
+ Addedi@^0.3.7
+ Addednpm@^9.2.0
+ Addedwikipedia@^2.0.0
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedi@0.3.7(transitive)
+ Addedinfobox-parser@3.6.4(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednpm@9.9.3(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedwikipedia@2.1.2(transitive)