Comments (8)
Your customsolver should take imageData
and return the text contained in the captcha image. I don't understand what your are doing with your API endpoint.
from node-google-search-scraper.
Yep, Absolutely, Right
That's what i'm trying to do, by rendering the image to the browser, entering the text into the input box and sending it to the captcha solver
Thanks for the help!
The whole code:
var scraper = require('google-search-scraper');
var application_root = __dirname,path = require("path");
//var DeathByCaptcha = require('deathbycaptcha');
var http = require('http')
, fs = require('fs');
var express = require('express'); // call express
var app = express.createServer(); // set our port
app.configure(function () {
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(application_root, "public")));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
//var dbc = new DeathByCaptcha('username', 'password');
var customSolver = {
solve: function(imageData, callback) {
// Do something with image data, like displaying it to the user
// id is used by BDC to allow reporting solving errors and can be safely ignored here
console.log(imageData);
//var router = express.Router(); // get an instance of the express Router
// if (err) throw err; // Fail if the file can't be read.
app.get('/api', function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<html><body><img src="data:image/jpeg;base64,')
res.write(new Buffer(imageData).toString('base64'));
res.write('"/>');
res.write('<form method="post" action="/api/bears/">');
res.write('<input type="text" name="user[name]">');
res.write('<input type="submit" value="Submit">');
res.write('</form>');
res.end('</body></html>');
});
app.post('/api/bears', function(req, res) {
console.log(req.body.user.name);
var id = null, err = null;
callback(err, id, req.body.user.name);
res.end();
});
}
};
app.listen(4242);
var options = {
query: 'site:edu "information theory"',
age: 'y', // less than a year,
solver: customSolver
};
scraper.search(options, function(err, url) {
// This is called for each result
if(err) throw err;
console.log(url)
});
from node-google-search-scraper.
If your code correctly returns the right decoded text to the callback then google probably changed its way to handle the captcha solution submission. It's very unexpected as seemingly the first part doesn't change, or your code wouldn't display a correct image.
If you want to make it work you'll have to investigate by navigating to google in your browser, solving the captcha by hand, looking at the form submission in the traffic and modifying the code so it behaves in the same way.
from node-google-search-scraper.
Great, Thanks!
I might have found the problem:
On doing the search on browser instead, google was returning two captchas one after the other
So, after getting the first one correct, it shows one more captcha.
from node-google-search-scraper.
Yes, After returning the captcha text,
maybe Google recognizes that the user is unauthorized to access the page and i get this html: , with statusCode 403
I'll update you, if i find a solution, Thanks!
from node-google-search-scraper.
Were you able to find a solution? Asking as I'm not having much luck with DBC as is.
from node-google-search-scraper.
any solution guys?
from node-google-search-scraper.
captchaId changed, use post instead of get, then it will return redirect url then get it again
var captchaId = $('input[name=q]').attr('value');
session.post({
uri: baseUrl + '/sorry/' + formAction,
qs: {
q: captchaId,
captcha: solution,
continue: continueUrl
}
}, function(err, res) { // get the res.headers.location if statusCode is 302})
from node-google-search-scraper.
Related Issues (16)
- return more than just url? HOT 6
- How would you use multiple keywords? HOT 1
- Do something when full search is done HOT 3
- How to use with proxy?
- Exception met with certain queries HOT 3
- Error: getaddrinfo ENOTFOUND www.google.comundefined www.google.comundefined:443 HOT 2
- url.js:103 throw new TypeError('Parameter "url" must be a string, not ' + typeof url); ^ TypeError: Parameter "url" must be a string, not undefined at Url.parse (url.js:103:11) HOT 1
- TypeError: Parameter "url" must be a string, not undefined
- How would you combing all the URLs in a single array? HOT 1
- Umlauts are not supported
- Error: getaddrinfo ENOTFOUND www.google.com HOT 2
- not working HOT 2
- limit not working HOT 4
- How to get multiple results? HOT 1
- is the min limit 10? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-google-search-scraper.