Adsense Script

2014年10月13日 星期一

免安裝Javascript版Apple Store iPhone 6 開賣Bot

免安裝Javascript版Apple Store iPhone 6 開賣Bot

本文章複製自 - {明式}: <a href='http://tatmingstudio.blogspot.hk/2014/09/javascriptapple-store-iphone-6-bot.html'>http://tatmingstudio.blogspot.hk/2014/09/javascriptapple-store-iphone-6-bot.html</a>
Copyright © ,屬{明式}所有.

http://tatmingstudio.blogspot.hk/2014/09/javascriptapple-store-iphone-6-bot.html


https://dl.dropboxusercontent.com/u/19160547/Files/ip6.txt

/* =Script Start = */

var ip6 = new Array("http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=silver&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=silver&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=silver&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=gold&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=gold&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=gold&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=space_gray&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=space_gray&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=4_7inch&option.dimensionColor=space_gray&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED");

var ip6plus = new Array("http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=silver&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=silver&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=silver&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=gold&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=gold&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=gold&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=space_gray&option.dimensionCapacity=16gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=space_gray&option.dimensionCapacity=64gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED",
"http://store.apple.com/hk-zh/buyFlowSelectionSummary/IPHONE6P?node=home/shop_iphone/family/iphone6&step=select&option.dimensionScreensize=5_5inch&option.dimensionColor=space_gray&option.dimensionCapacity=128gb&option.carrierModel=UNLOCKED%2FWW&carrierPolicyType=UNLOCKED");

// iPhone6 and iPhone plus - 2 models x 3 color x 3 storage.
var ipmerge = ip6.concat(ip6plus);

function notifyMe( title, message) {
   var iconurl = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmGG9G4HGfacfXa-aBnJcIQ8l2CkNH8bnFX4nvlvlnJrS0BsBL2G7RBA7bTBqdz957AnRtT4eDFk6UuohgjSPPcvxgqNiUQduaO29oE_KvTf5pfll0-AyYt9h5_a6V0Eilbt__XoGuxJjp/s72/ic_appstore.png";
  if (!("Notification" in window)) {
    alert("This browser does not support desktop notification");
  }

  else if (Notification.permission === "granted") {
    var notification = new Notification(title , { body: message , icon: iconurl });
  }

  else if (Notification.permission !== 'denied') {
    Notification.requestPermission(function (permission) {

      if(!('permission' in Notification)) {
        Notification.permission = permission;
      }

      if (permission === "granted") {
        var notification = new Notification(title , { body: message , icon: iconurl });
      }
    });
  }
}

var beep = (function () {
 var AudioContext = window.AudioContext || window.webkitAudioContext;
 var ctx = new AudioContext();
    return function (duration, type, finishedCallback) {
        duration = +duration;
        // Only 0-4 are valid types.
        type = (type % 5) || 0;
        if (typeof finishedCallback != "function") {
            finishedCallback = function () {};
        }
        var osc = ctx.createOscillator();
        osc.type = type;
        osc.connect(ctx.destination);
        osc.start(0);
        setTimeout(function () {
            osc.stop(0);
            finishedCallback();
        }, duration);
    };
})();

function getNow() {
        var todayDate = new Date();
        todayDate = todayDate.getFullYear() + "-" +
                       ("0" + (todayDate.getMonth() + 1)).slice(-2) + "-" +
                       ("0" + todayDate.getDate()).slice(-2) + " " + ("0" + todayDate.getHours()).slice(-2) + ":" +
                       ("0" + todayDate.getMinutes()).slice(-2);
 
        return todayDate;
}

function queryString(url) {
    var qs = url.substring(url.indexOf('?') + 1).split('&');
    for(var i = 0, result = {}; i < qs.length; i++){
        qs[i] = qs[i].split('=');
        result[qs[i][0]] = decodeURIComponent(qs[i][1]);
    }
    return result;
}

function getJson(url) {
var r = "";
try {
 xmlhttp=new XMLHttpRequest();
 xmlhttp.open("GET", url ,false);
 xmlhttp.send();
 if (xmlhttp.status == 200)
 r =xmlhttp.responseText; 
}
catch(err) {
    console.log(err.message);
}
return r;
}

/* Stop manually */
function stop() {
 clearTimeout(timeoutHandle);
 timeoutHandle = null;
 console.log('The script is stop...');
}

var isBeep = '';
var timeoutHandle;
if(timeoutHandle) stop(); //refresh the handler.
    
function run() {
    timeoutHandle  = setTimeout(function () {
        // create a recursive loop.
        var json = "", model = "", t = "";
        console.clear();
   for (var i= 0; i < ipmerge.length; i++) {
    json = getJson(ipmerge[i]);
       model =  'iPhone 6 ' + 
     queryString(ipmerge[i])['option.dimensionScreensize'].replace('_','.') + ' ' + 
     queryString(ipmerge[i])['option.dimensionColor'].replace('_',' ') + ' ' + 
     queryString(ipmerge[i])['option.dimensionCapacity'];
    t = getNow();
    console.log(t + ' - Checking... ' + model + ' success.');
    if (json != "" && json.indexOf("\"isBuyable\":true") > 0) {
      notifyMe("開賣喇!" + ' - ' + t, model);
         if (isBeep == '') beep(20000, 1, function () {isBeep = 'done'; });
     }
   }
   json = null;
        run();
    }, 20000); 
}

/* Start */
run();  //Change to stop() , to stop the service.
notifyMe("The script is start!" , "Running...");

/* = End of the Script =*/

沒有留言:

張貼留言