-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (38 loc) · 1.34 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var express = require('express');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var app = express();
var bodyParser = require('body-parser');
// Why is this not in the framework? I don't know.
app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
app.get('/', function(req, res) {
// Dirty butfuckit
res.send(
'<h1>Please login below</h1><form action="/" method="post">' +
'<input id="email" name="email"></input>' +
'<input id="extra" name="extra"></input>' +
'<button>Login</button></form>'
);
});
app.post('/', function(req, res){
var email = req.body.email;
var password = req.body.extra;
url = 'https://auth.uber.com/login';
var request = require('request'); //scoping hell
var request = request.defaults({jar: true}) // Store the cookieeeeesss
request(url, function(error, response, html){
if(!error){
var $ = cheerio.load(html);
console.log($('.text-input'))
$('.header').filter(function(){
var data = $(this);
title = data.children().first().text();
json.title = title;
})
}
})
})
app.listen('8181')
exports = module.exports = app;