Skip to content

Instantly share code, notes, and snippets.

@lynzz
Last active March 16, 2019 02:41
Show Gist options
  • Save lynzz/10094918 to your computer and use it in GitHub Desktop.
Save lynzz/10094918 to your computer and use it in GitHub Desktop.
小米粉丝节 抢购
/**
* 小米粉丝节,购买小米的请求, 用 chrome 打开 xiaomi 下的随便一个网页,打开控制台,把代码粘贴进去运行即可
*
* http://p.www.xiaomi.com/zt/140408/www/www-buy-phone-succ.html?pro=2141200012
* http://order.xiaomi.com/event/selectPacketForPhone/goodsid/2141200012
* http://order.xiaomi.com/cart/add/2140100007?source=bigtap&token=f5fa8da7637f36135fb8d3812d520adb,28358371,2140100007,1396958984,1,1,&jsonpcallback=jQuery181010688144038431346_1396958966070
* @return {[type]} [description]
*/
$(function() {
var FuckXiaoMi = {
// 2141200012 红米note,
// 2141300060 红米手机
// 2140100007 小米3
// 2135000503 小米2s
product: ['2141300060'],
timer: null,
speed: 500,
start: function() {
var products = FuckXiaoMi.product;
this.timer = window.setInterval(FuckXiaoMi.send, FuckXiaoMi.speed);
},
send: function() {
var products = FuckXiaoMi.product;
$.each(products, function(index, product) {
$.ajax({
url: "http://tp.hd.xiaomi.com/hdget/cn?product=" + product + "&addcart=1&m=1",
type: "get",
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "hdcontrol",
success: function(jsonObject) {
var status = jsonObject.status[product];
// f5fa8da7637f36135fb8d3812d520adb,28358371,2140100007,1396958984,1,1,
var hdurl = status.hdurl;
if (status && hdurl != '') {
window.clearInterval(FuckXiaoMi.timer);
$.ajax({
url: 'http://order.xiaomi.com/cart/add/' + product + '?source=bigtap&token=' + hdurl,
dataType: 'jsonp'
});
console.log(hdurl);
return false;
}
var login = jsonObject.login;
console.table("[login:" + login + ",mipower:" + hdurl + "]");
},
error: function() {
console.table("网络超时or官网接口有变。。。");
}
});
});
}
};
FuckXiaoMi.start();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment