-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhwm-work-server.js
29 lines (25 loc) · 910 Bytes
/
hwm-work-server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Antigate = require('antigate');
var express = require('express')
var app = express();
var ag = new Antigate('***'); // paste here your Antigate key (instead of ***)
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/cap/:capUrl', function (req, res) {
ag.processFromURL(req.params.capUrl, function(error, text, id) {
if (error) {
console.log(error);
} else {
console.log('Now: ', new Date());
console.log('Your request: ', req.url);
console.log('Captcha: ', text);
res.send(text.toLowerCase()); // comment this line to test manual server response
}
});
// res.send('km9ucn'); // uncomment to test manual server response
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});