![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
gsearch-node
Advanced tools
var deathByCaptcha = require("deathbycaptcha")
var dbc = new deathByCaptcha("username", "password")
var gsearch = require("gsearch-node")
var gs = new gsearch({solver: dbc})
Initailization (with custom solver)
var captchaSolver = {
solve: function (img, cb) {
//doSomeCaptchaSolving
if (err) {
cb (null, {
err: err,
solution: null
})
return
}
cb (null, {
err: null,
solution: "solved captcha as string"
})
}
}
API methods
gs.get(searchString, cb)
This is an async function which returns a cb
with (nullVar, respObj)
.
nullVar
is a variable with null
value.
respObj
is an object with following structure :-
respObj = {
err: null,
resp: {}, // a response object from request library. use respObj.resp.body to get the html.
parsed: {} // parsed html using whacko lib (a fork of cheerio).
// so you can apply css selectors directly.
}
gs.getSync(seachString)
This is a sync function which returns 'respObj' as described above.
Note on callbacks
The format of callbacks for this API is not (err, resp)
but is (nullVar, respObj)
where err
is a property of respObj
.
This is because I have used deasync lib which throws err
if (err, resp)
format is used for the callback which make the code to break.
Error handling is more easier as we can use if
syntax instead of try catch
.
(function () {
// var deathByCaptcha = require("deathbycaptcha")
// var dbc = new deathByCaptcha("username", "password")
var gsearch = require("gsearch-node")
var gs = new gsearch({solver: {}}) // {solver: dbc} for using deathbycaptcha api
console.log("Sync version")
var searchPage = gs.getSync("Everyone shifting to nodejs?")
if (!searchPage.err) {
$ = searchPage.parsed
$("a").each(function (i, a) {
console.log($(a).attr("href"))
})
} else {
console.log(searchPage.err)
}
console.log("\nAsync version")
gs.get("Everyone shifting to nodejs?", function (nullVar, searchPage) {
if (!searchPage.err) {
$ = searchPage.parsed
$("a").each(function (i, a) {
console.log($(a).attr("href"))
})
} else {
console.log(searchPage.err)
}
})
})()
If this repository helps you anyhow, please don't mind coming back and Buy Me Coffee OR you can use Gratipay to show your appreciation and gratitude.
FAQs
API for making google search requests with captcha support
The npm package gsearch-node receives a total of 1 weekly downloads. As such, gsearch-node popularity was classified as not popular.
We found that gsearch-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.