Skip to content

Instantly share code, notes, and snippets.

@meteormatt
Last active October 8, 2016 15:14
Show Gist options
  • Save meteormatt/f2430aebf089523770006362be6b795b to your computer and use it in GitHub Desktop.
Save meteormatt/f2430aebf089523770006362be6b795b to your computer and use it in GitHub Desktop.
优酷
/**
* 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));
});
}
});
#!/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