Monitor robot of Apple Store's products, using DingTalk notification.

Overview

概述

本项目应用主要用来监测Apple Store线下直营店货源情况,主要使用Python实现。

首先感谢iPhone-Pickup-Monitor项目带来的灵感,同时有些实现也直接使用了该项目的一些代码。

本项目在iPhone-Pickup-Monitor原有功能的基础上去掉了声音通知,但添加了多货源同时监控以及钉钉消息通知功能。

安装

# 拉取代码 
git clone https://github.com/LennonChin/AppleStore-Monitor.git

# 进入目录
cd AppleStore-Monitor

# 安装依赖
pip install -r requirements.txt

申请钉钉群机器人

【强烈建议配置】如不配置则没有通知功能。

本监控提供了钉钉监控的功能,可以在监控到有货源时将消息发送到钉钉群。如要启用该功能,首先需要创建一个钉钉群,并添加群机器人,详细可参考文档:

自定义机器人接入

机器人配置完毕后,记下相关的Access Token和Secret Key,后面配置时需要用到。

开始配置

可以配置多个监控商品:

$> python monitor.py config
--------------------
[0] AirPods
[1] iPhone 13
选择要监控的产品:0
--------------------
[0] AirPods
[1] AirPods Max
选择要监控的产品子类:1
--------------------
[0] AirPods Max - 银色
选择要监控的产品型号:0
--------------------
是否添加更多产品[Enter继续添加,非Enter键退出]:
--------------------
[0] AirPods
[1] iPhone 13
选择要监控的产品:1
--------------------
...
[3] iPhone 13 Pro Max
选择要监控的产品子类:3
--------------------
...
[11] 512GB 远峰蓝色
...
选择要监控的产品型号:11
--------------------
是否添加更多产品[Enter继续添加,非Enter键退出]:n
选择计划预约的地址:
请稍后...1/3
--------------------
[0] 北京
[1] 上海
...
请选择序号:1
请稍后...2/3
请稍后...3/3
--------------------
[0] 黄浦区
...
请选择序号:0
正在加载网络资源...
--------------------
输入钉钉机器人Access Token[如不配置直接回车即可]:# 此处如不配置,就没有通知功能
输入钉钉机器人Secret Key[如不配置直接回车即可]:# 此处如不配置,就没有通知功能
--------------------
输入扫描间隔时间[以秒为单位,默认为15秒,如不配置直接回车即可]:30 # 不建议太短,以免扫描过于频繁导致IP被封
扫描配置已生成,并已写入到apple_store_monitor_configs.json文件中
请使用 python monitor.py start 命令启动监控

配置完成后,会在当前目录下生成一个apple_store_monitor_configs.json文件:

{
  "selected_products": {
    "MGYJ3CH/A": [
      "AirPods Max",
      "AirPods Max - \u94f6\u8272"
    ],
    "MLHG3CH/A": [
      "iPhone 13 Pro Max",
      "512GB \u8fdc\u5cf0\u84dd\u8272"
    ]
  },
  "selected_area": "\u4e0a\u6d77 \u4e0a\u6d77 \u9ec4\u6d66\u533a",
  "dingtalk_configs": {
    "access_token": "",
    "secret_key": ""
  },
  "scan_interval": 30
}

如果你明白每项的意思,也可以手动填写该JSON文件,不过一定要按照上面例子中的层级,尤其是selected_products部分。

另外欢迎各位补充本项目的products.json文件,添加更多产品信息。

启动监控

接下来只需要用下面的命令启动监控即可:

比如前台启动:

$> python monitor.py start

或者后台启动:

$> nohup python -u monitor.py start > monitor.log 2>&1 &

通知效果

4种情况会通知:

  1. 启动时通知,以确认相关信息是否正确,启动是否成功。
  2. 扫描到有货源时会通知。
  3. 每天6:00 ~ 23:00整点报时,以确保程序还正常运行。
  4. 程序异常时会通知,如不是致命异常,不用理会。

相关通知截图:

NotificationExample.png

You might also like...
This app is providing you to track some online products' prices via GMAIL.

Price Tracking App variables and descriptions of that code is in Turkish language. but we're working on translate them into English. This app is provi

Script to get a notification when a product, on Amazon Warehouse, is available within a target price

Amazon_Warehouse_Scraping This script aims to scrape Amazon Warehouse and send an email back if there are products whose price matches with the target

Notification Reminder Application For Python
Notification Reminder Application For Python

Notification-Reminder-Application No matter how well you set up your to-do list and calendar, you aren’t going to get things done unless you have a re

Starlink Order Status Notification

Starlink Order Status Notification This script logs into Starlink order portal, pulls your estimated delivery date and emails it to a designated email

Best Buy Bot used to add products to cart for purchase.

To Install the Best Buy Bot These instructions are for Mac users only. Clone this Repo to your machine. BestBuyBot Open in VScode. Is Python installed

A delivery protection and notification system

DeliveryProtect This project builds a delivery protection and notification system, based on integration of Arduino Uno and Raspberry Pi 4. The codes a

python based bot Sends notification to your telegram whenever a new video is released on a youtube channel!

YTnotifier python based bot Sends notification to your telegram whenever a new video is released on a youtube channel! REQUIREMENTS telethon python-de

Faster Twitch Alerts is a highly customizable, lightning-fast alternative to Twitch's slow mobile notification system

Faster Twitch Alerts What is "Faster Twitch Alerts"? Faster Twitch Alerts is a highly customizable, lightning-fast alternative to Twitch's slow mobile

Sends notifications when Pokemon Center products are in stock

Sends notifications when Pokemon Center products are in stock! If you use this for scalping, I will break your kneecaps

Comments
  • added timeout for requests on monitoring

    added timeout for requests on monitoring

    在程序监控过程中,可能遇到与www.apple.com.cn连接不稳定, 会导致程序一直等待requests返回而卡死, 在实际运行中表现为: 控制台打印出:“x秒后进行第y次尝试...” 之后不再有反应, 所以可以加上timeout参数,超出timeout时间之后抛出异常, 捕获之后程序可以继续正常运行。

    opened by tmaccs 0
Owner
Lennon Chin
Lennon Chin
ShotsGram - For sending captures from your monitor to a telegram chat (robot)

ShotsGram pt-BR Envios de capturas do seu monitor para um chat do telegram. Essa

Carlos Alberto 1 Apr 24, 2022
This is a scalable system that reads messages from public Telegram channels using Telethon and stores the data in a PostgreSQL database.

This is a scalable system that reads messages from public Telegram channels using Telethon and stores the data in a PostgreSQL database. Its original intention is to monitor cryptocurrency related channels, but it can be configured to read any Telegram data that is accessible through the API.

Greg 3 Jun 7, 2022
Lambda-function - Python codes that allow notification of changes made to some services using the AWS Lambda Function

AWS Lambda Function This repository contains python codes that allow notificatio

Elif Apaydın 3 Feb 11, 2022
CRUD database for python discord bot developers that stores data on discord text channels

Discord Database A CRUD (Create Read Update Delete) database for python Discord bot developers. All data is stored in key-value pairs directly on disc

Ankush Singh 7 Oct 22, 2022
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 76 Dec 29, 2022
Benachrichtigungs-Bot für das niedersächische Impfportal / Notification bot for the lower saxony vaccination portal

Ein kleines Wochenend-Projekt von mir. Der Bot überwacht die REST-API des niedersächsischen Impfportals auf freie Impfslots und sendet eine Benachrichtigung mit deinem bevorzugtem Service. Ab da gilt leider: der Schnellste gewinnt. Bitte missbraucht den Bot nicht und verwendet moderate Intervalle.

sibalzer 37 May 11, 2022
Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel!

YouTube Feeds Bot. Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel! Variables BOT_TOKEN

Aditya 30 Dec 7, 2022
🔪 Block replies to viral tweets from users getting paid to promote useless products

This Tweet Took Off Ublock Origin filter list targeting long reply chains posted by twitter users who get paid to promote random products on viral twe

Xetera 12 Jan 14, 2022
This is a simple grabber written in Python which helps you to grab products from Willhaben.at

Willhaben Grabber This is a simple grabber written in Python which helps you to grab products from Willhaben.at General info The tool generates a sear

Ramo 0 Feb 16, 2022
A chatbot that helps you set price alerts for your amazon products.

Amazon Price Alert Bot Description A Telegram chatbot that helps you set price alerts for amazon products. The bot checks the price of your watchliste

Rittik Basu 24 Dec 29, 2022