检查 iPhone 是否有货,有货则语音播报,适用于 macOS
# coding: utf-8 | |
import requests | |
import time | |
import os | |
import urllib3 | |
urllib3.disable_warnings() | |
store_url = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/A/stores.json' | |
products = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/A/availability?iUP=N' | |
availability_url = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/A/availability.json' # iPhone 12 Pro | |
# availability_url = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/F/availability.json' # iPhone 12 | |
stores = [('R388', '西单'), ('R448', '王府井'), ('R320', '三里屯')] | |
# stores = [('R320', '三里屯')] | |
product = 'MGLE3CH/A' # iPhone 12 Pro 256G 石墨黑色 | |
# product = 'MGGU3CH/A' # iPhone 12 128GB 黑色 | |
product = 'MGLF3CH/A' # iPhone 12 Pro 256G 银色 | |
product = 'MGL93CH/A' # iPhone 12 Pro 128G 石墨色 | |
product = 'MGLA3CH/A' # iPhone 12 Pro 128G 银色 | |
products = [ | |
('MGL93CH/A', 'iPhone 12 Pro 128G 石墨色'), | |
('MGLA3CH/A', 'iPhone 12 Pro 128G 银色'), | |
('MGLE3CH/A', 'iPhone 12 Pro 256G 石墨黑色'), | |
('MGLF3CH/A', 'iPhone 12 Pro 256G 银色'), | |
] | |
print('店铺:', stores) | |
print('型号:', product) | |
s = requests.Session() | |
s.headers['User-Agent'] = 'Mozilla/5.0' | |
i = 0 | |
while True: | |
i += 1 | |
try: | |
availability = s.get(availability_url, verify=False).json() | |
for store in stores: | |
for product in products: | |
product_availability = availability['stores'][store[0]][product[0]] | |
unlocked_state = product_availability['availability']['unlocked'] | |
print(i, '\t', store[1], '\t', product[1], '\t', product_availability) | |
if unlocked_state: | |
os.system('say ' + store[1] + product[1]) | |
except Exception as e: | |
print(i, '还没开始', e) | |
time.sleep(1) |
# coding: utf-8 | |
import requests | |
import time | |
import os | |
store = 'https://reserve-cn.apple.com/CN/zh_CN/reserve/iPhone/stores.json' | |
target = [('R388', '西单'), ('R448', '王府井')] | |
black = 'MNFP2CH/A' | |
availability = 'https://reserve-cn.apple.com/CN/zh_CN/reserve/iPhone/availability.json?t=' | |
i = 0 | |
while True: | |
try: | |
state = requests.get(availability + str(time.time())).json() | |
i += 1 | |
for t in target: | |
print state[t[0]][black], | |
if state[t[0]][black] != 'NONE': | |
os.system('say ' + t[1]) | |
if i % 15 == 0: | |
print '' | |
time.sleep(1) | |
except: | |
print '还没开始' |
# coding: utf-8 | |
import requests | |
import time | |
import os | |
store_url = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/iPhoneX/stores.json' | |
stores = [('R388', '西单'), ('R448', '王府井')] | |
product = 'MQA82CH/A' | |
availability_url = 'https://reserve-prime.apple.com/CN/zh_CN/reserve/iPhoneX/availability.json' | |
s = requests.Session() | |
s.headers['User-Agent'] = 'Mozilla/5.0' | |
i = 0 | |
while True: | |
try: | |
availability = s.get(availability_url).json() | |
i += 1 | |
for store in stores: | |
iphone_state = availability['stores'][store[0]][product]['availability']['unlocked'] | |
print i, '\t', store[1], '\t', availability['stores'][store[0]][product] | |
if iphone_state: | |
os.system('say ' + store[1]) | |
except: | |
print '还没开始' | |
time.sleep(1) |
This comment has been minimized.
This comment has been minimized.
iPhone 12 Pro 256G 石墨黑色 型号:MGLE3CH/A |
This comment has been minimized.
This comment has been minimized.
苹果预约短信号码:10690300496001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
iPhone X 256G 深空灰色 型号:MQA82CH/A