苹果官网抢翻新机过程
需要用到的工具:
1、谷歌浏览器油猴(tamperMonkey)扩展程序,
2、自建的钉钉群一个,添加WebHook机器人,出现token后将里面的token复制出来,具体可参见:https://blog.csdn.net/sunriseYJP/article/details/126764043
其中这个机器人要设置关键词,比如MBP
将下面脚本:
// ==UserScript==
// @name RefurbishedAppleMonitor
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.apple.com.cn/shop/product/G15J4CH/*
// @match https://www.apple.com.cn/shop/product/G15JECH/*
// @match https://www.apple.com.cn/shop/product/G15G4CH/*
// @match https://www.apple.com.cn/shop/product/G15GECH/*
// @match https://www.apple.com.cn/shop/product/FLXY3CH/*
// @grant GM_xmlhttpRequest
// ==/UserScript==
const WEBHOOK_URL = "https://oapi.dingtalk.com/robot/send?access_token=钉钉群机器人token"
const webhookNotify=()=>{
const data ={
"msgtype": "text",
"text": {
"content": "[重要]你想要的MBP上架了,速抢!"
},
"at": {
"atMobiles": [
"这里填想At人的手机号"
]
}
}
GM_xmlhttpRequest({
method: "POST",
url: WEBHOOK_URL,
headers: {
"Content-Type": "application/json"
},
data: JSON.stringify(data),
onload: function(res){
console.log("Request complete! response:", res);
},
onerror: function(res){
console.log("请求失败", res);
}
});
}
//10 messages in 10 seconds.
const webhookNotifyLoop = (counter=0)=>{
if(counter < 10){
console.log('counter:',counter)
webhookNotify();
setTimeout(()=>{webhookNotifyLoop(counter+1)}, 1000);
}
}
const checkIsStockAvailable=()=>{
var buyButton = document.getElementById("add-to-cart");
return(!buyButton.disabled)
}
const checkAndAlert = ()=>{
if(checkIsStockAvailable()){
console.log('Stock available :)',new Date())
webhookNotifyLoop()
}else{
console.log('Still out of stock:(',new Date())
}
}
(function() {
checkAndAlert();
setTimeout(()=>{ location.reload(); }, 3600*60*1000); //refresh every 60 seconds.avoiding interrupt change to 1 hour
})();
其中
// @match https://www.apple.com.cn/shop/product/FLXY3CH/*
FLXY3CH 是苹果官网翻新机的现有机型,可以选择一个自己喜欢型号
钉钉群机器人token 是钉钉群中添加的webhook机器人token
这里填想At人的手机号 这句话直接替换成自己的手机号就行
都设置成功以后,注意最后一行
refresh every 60 seconds.avoiding interrupt change to 1 hour
1*60*1000 表示1秒,如果不想要总发信息,可以设置更大一些。
感谢朋友的分享。

浙公网安备 33010602011771号