A Python script that scrapes your Instacart order history and saves the data in a JSON file.
The data scraped includes:
- Order date
- Number of unique items
- Order total
- Whether the order was cancelled
- The delivery photo URL (if any)
- The list of items, where the data for each item includes:
- Item name
- Item unit price
- Item unit description (usually weight if applicable)
- Item unit quantity
- Ensure Python dependencies are installed:
pip install -r requirements.txt - Ensure you have Chromium or Google Chrome installed.
- Ensure you have Chrome Webdriver installed and that it is compatible with the version of Chromium/Chrome you have.
- On Linux, you can run
installChromeDriver.shto automatically install/update ChromeDriver in/usr/local/bin,
- On Linux, you can run
- Run the script:
python main.py- You can use the
--afterargument to only include orders after a certain date/time (format is%Y-%m-%d %H:%M). - The output is printed to the terminal; if you would like to also save it to a file, use the
--fileargument with a valid file path.- If specified file already exists, it is assumed to be a JSON previously generated by this script for the same Instacart account. In this case, only orders newer than the last order from the existing file are scraped, and the output is a merged file containing all orders. You cannot use the
--afterargument in this case.
- If specified file already exists, it is assumed to be a JSON previously generated by this script for the same Instacart account. In this case, only orders newer than the last order from the existing file are scraped, and the output is a merged file containing all orders. You cannot use the
- You can use the
- You can use the Node.js script
downloadImages.jswith a JSON file generated bymain.pyto download all delivery photos and product thumbnails linked in that file. - You can use
backup.shto runmain.pyandinstallImages.jsin a way that is ideal for periodic backups to a dedicated directory (including auto-copying delivery photos to another directory and running another script on them). - You can run
analyze.pywith the path to a JSON generated frommain.pyto generate a CSV that lists all unique items with their average units purchased per month, average units purchased per order, and price fluctuation history.- You can use the
--selectargument to get that info for a specific item only on the terminal. analyze.pyalso accepts the--afterdate argument.
- You can use the