Skip to content

Instantly share code, notes, and snippets.

@leplay
Last active August 29, 2015 14:08
Show Gist options
  • Save leplay/3c1aff5d82456c7c2be5 to your computer and use it in GitHub Desktop.
Save leplay/3c1aff5d82456c7c2be5 to your computer and use it in GitHub Desktop.
Check iPhone 6
var map = {
R079: '銀座',
R119: '渋谷',
R224: '表参道'
};
var model = ['MG4F2J/A', 'MG4J2J/A'];
// 灰色 64G, 金色 64G
function check() {
$.ajax({
url: 'https://reserve.cdn-apple.com/JP/ja_JP/reserve/iPhone/availability.json?v=' + (new Date().getTime()),
success: function(resp) {
if (resp.R079 || resp.R119 || resp.R224) {
console.log(resp.R079['MG4F2J/A']);
var availableStores = [];
if (resp.R079['MG4F2J/A']) {
availableStores.push(map.R079);
}
if (resp.R119['MG4F2J/A']) {
availableStores.push(map.R119);
}
if (resp.R224['MG4F2J/A']) {
availableStores.push(map.R224);
}
if (availableStores.length) {
$.ajax({
url: 'https://api.pushover.net/1/messages.json?token=TOKEN&user=USERp&message=iPhone6' + availableStores.join('/') + '&priority=1',
type: 'POST'
});
console.log(new Date());
alert('AVAILABLE NOW!!!' + availableStores.join('/'));
}
} else {
console.log('data error!')
}
}
});
}
setInterval(check, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment