A Python automation tool that monitors product stock on e-commerce sites using Playwright . When selected product options become available, it sends real-time SMS notifications.
This project is currently tailored for Pop Mart, where it checks the availability of Single Box and Whole Set options. Stock status is determined by detecting whether product options are styled with a line-through (indicating they are out of stock).
Current Version: 0.1.0 (Alpha)
This release is functional on local machines and demonstrates the core features of the project.
Headless support and deployment testing on Raspberry Pi are not yet implemented.
Planned improvements:
- Add headless mode for Raspberry Pi deployment.
- Expand automated testing.
- Refine documentation and usage examples.
- Python 3.11
- Twilio API (SMS alerts)
- Playwright (browser automation for monitoring stock availability)
- python-dotenv (manage environment variables securely)
- JSON (simple local persistence for stock tracking)
- Git & GitHub (version control)
- ✅ Automatically check multiple product URLs
- ✅ Detect whether product options are in stock or out of stock
- ✅ Return clean boolean output for easy automation
- ✅ Send SMS alerts when desired items are available
- ✅ Store and track stock status using JSON to avoid duplicate notifications
- ✅ Auto-add items to cart (experimental)
- ✅ Designed to run on a local machine or Raspberry Pi
.
├── .gitignore # Ignore virtual env, .env, etc.
├── .env # Local environment variables (Twilio keys, phone number)
├── config.py # Imports env variables for scripts
├── app.py # Main entry point to run product checks
├── requirements.txt # Python dependencies
├── README.md # Project documentation
└── scripts/ # All individual scripts
├── line_through_check.py # Core stock checker script
├── detect_stock.py # Optional/legacy stock checking
└── send_sms.py # Sends SMS notifications for in-stock items
Here’s a screenshot of the app in action:
-
app.py
Main entry point. Iterates through a list of product URLs and prints stock availability for each. -
scripts/line_through_check.py
Core stock checker. Contains thecheck_stock()function that returns a dictionary of{option: bool}(e.g.,{"Single Box": True, "Whole Set": False}). -
Other experimental scripts (optional)
You may still have older scripts likedetect_stock.pyorcheck_options.pyin the repo. These were early tests and can be cleaned up later. The main production-ready script isline_through_check.py.
-
Clone the repository:
git clone https://github.com/nievyx/playwright-auto-checker.git cd project-name -
Set up a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # Mac/Linux venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt playwright install
Run a stock check on a single product:
python scripts/line_through_check.pyOr run checks on multiple products with:
python app.pyExample output:
Checking product: https://www.<example>.com/gb/products/1036/<example>-Echo-Series-Figures
Single Box: IN STOCK
Whole Set: OUT OF STOCK
Create a .env file (local only)
TWILIO_ACCOUNT_SID=your_account_sid_here
TWILIO_AUTH_TOKEN=your_auth_token_here
TWILIO_PHONE_NUMBER=+1234567890
MY_PHONE_NUMBER=+0987654321
- Tailor application to run headlessly on systems like Raspberry Pi and local machines
- Add Discord as message option
MIT License
Copyright (c) 2025 Nievyx
See LICENSE file for details.