Last active
October 8, 2016 15:14
-
-
Save meteormatt/f2430aebf089523770006362be6b795b to your computer and use it in GitHub Desktop.
优酷
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Meteor on 16/8/9. | |
*/ | |
var request = require('request'); | |
request = request.defaults({jar: true, followAllRedirects: true}); | |
// require('request').debug = true; | |
let username = '用户名'; | |
let password = '密码'; | |
request.post({ | |
url: 'https://login.youku.com/user/login_submit/', | |
form: { | |
'passport': username, | |
'password': password, | |
'captcha': '', | |
'remember': '1', | |
'callback': 'logincallback_' + Date.now(), | |
'from': 'http://login.youku.com/', | |
'wintype': 'page', | |
} | |
}, (err, res, body)=> { | |
console.log(res.statusCode, body); | |
if (res.statusCode == 200) { | |
request.post('http://vip.youku.com/?c=ajax&a=ajax_do_speed_up', (err, res, body)=> { | |
console.log(res.statusCode, JSON.parse(body)); | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
timestamp=`date +%s%N | cut -b1-13` | |
username='用户名' | |
password='密码' | |
data="passport=${username}&password=${password}&captcha&remember=1&callback=logincallback_${timestamp}&from=http://login.youku.com/&wintype=page" | |
curl -L -X POST -c cookies.txt -d $data "https://login.youku.com/user/login_submit/" | |
echo | |
curl -b cookies.txt "http://vip.youku.com/?c=ajax&a=ajax_do_speed_up" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment