Skip to content

Instantly share code, notes, and snippets.

@iakshay
Last active August 29, 2015 14:05
Show Gist options
  • Save iakshay/ea4c05a6e7448ff2cb2f to your computer and use it in GitHub Desktop.
Save iakshay/ea4c05a6e7448ff2cb2f to your computer and use it in GitHub Desktop.
Flipkart Xiaomi Mi3 Hack
/* Flipkart stuff - just making this global*/
function getMyToken() {
var cookies = " " + document.cookie,
cookieName = "aid";
var index = cookies.indexOf(" " + cookieName + "=");
if (index == -1) {
index = cookies.indexOf(";" + cookieName + "=");
}
if (index == -1 || cookieName == "") {
return false;
}
var lastIndex = cookies.indexOf(";", index + 1);
if (lastIndex == -1) {
lastIndex = cookies.length;
}
return unescape(cookies.substring(index + cookieName.length + 2, lastIndex));
}
var url = 'http://api1.flipkart.com/xmi?aid=';
var aid = getMyToken();
setInterval(function(){
/* The MAIN REQUEST */
$.ajax({
"url": url + encodeURIComponent(aid),
"dataType": "json",
"type" : "POST"
})
.done(function (data) {
/* If status is SUCCESS you booked the phone! */
console.log(data.status);
});
}, 1000); /* *Sending request after 1000ms, you can reduce this further. More requests might get you a ban! */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment