Skip to content

schmwong/APAC-McDelivery-Menu-Logger

Repository files navigation

McDelivery Menu Logger (APAC Region)

Overview

McDonald's allows its franchisees some leeway in menu pricing, hence there may be a slight variation in in-store prices across different franchise locations in the same country. Such prices are not widely accessible online.

Price figures recorded here are from each territory's online McDelivery menu, which is consistent within said country / territory.

Table of Links

What Each Column is For

Vendor Page points to the official McDelivery order webpage, or, if it is not accessible by script, to an assigned delivery partner.
Scraper Script is a direct link to the .py script that is executed by the workflow to scrape menu data.
Scraped Files links to the folder holding the scraped data in csv file format.
Workflow File is a direct link to the auto scraper file that is automatically triggered by a cron schedule.


Vendor Page Scraper Script Scraped Files Workflow File
ubereats Australia mcd-scr-au.csv scrape-au-auto.yml
gomamam Brunei mcd-scr-bn.csv scrape-bn-auto.yml
fijieats Fiji mcd-sel-fj.csv scrape-fj-auto.yml
foodpanda Hong Kong mcd-scr-hk.csv scrape-hk-auto.yml
mcdelivery India mcd-req-in.csv scrape-in-auto.yml
mcdelivery Indonesia mcd-bs4-id.csv scrape-id-auto.yml
mcdelivery Japan mcd-bs4-jp.csv scrape-jp-auto.yml
mcdelivery South Korea mcd-bs4-kr.csv scrape-kr-auto.yml
mcdelivery Malaysia mcd-bs4-my.csv scrape-my-auto.yml
ubereats New Zealand mcd-scr-nz.csv scrape-nz-auto.yml
mcdelivery Pakistan mcd-bs4-pk.csv scrape-pk-auto.yml
mcdelivery Philippines mcd-scr-ph.csv scrape-ph-auto.yml
mcdelivery Singapore mcd-bs4-sg.csv scrape-sg-auto.yml
mcdelivery Sri Lanka mcd-bs4-lk.csv scrape-lk-auto.yml
mcdelivery Taiwan mcd-bs4-tw.csv scrape-tw-auto.yml
mcdelivery Thailand mcd-bs4-th.csv scrape-th-auto.yml
mcdelivery Vietnam mcd-bs4-vn.csv scrape-vn-auto.yml

Exclusions

Delivery fees are not included. Surcharges for drink changes and menu upsizes are also not included. Vouchers, in-store and in-app promotions are not included, unless explicitly itemised in the vendor's webpage scraped by the script.

USD for Price Comparison

For ease of comparison, all prices are recorded in both local currency and USD.

The exchange rate is fetched live from Xe.com just prior to scraping McDelivery menu data. This rate is the mid-market rate, not the send rate. Please do not rely on it to make purchases.


Project Architecture and Nomenclature

.
├── .github/workflows/
│   ├── Auto scraper workflow files
│   └── Maintenance workflow files
├── Territory folders: mcd-<library>-<ccTLD>/
│   ├── Scraper Script
│   └── scraped-data/
│       └── Scraped Files
├── default-schedule.csv
└── .py Maintenance scripts

1. Territory Folders

Except the workflow files, each territory has its associated files sequestered in its own folder. There are no shared user modules. Each territory, as a separate entity, has its code developed individually.

The territory folder and its associated files follow a common naming convention:

mcd-<library>-<ccTLD>

Scraped data files are housed in a scraped-data folder within the territory folder. Each file is prefixed with an additional timestamp

[yyyy-mm-dd hh:mm:ss]

in Local Date and Time.

mcd prefix : scraping McDonald's data.
library : main library or framework used to scrape webpage data. Click for details.
ccTLD suffix : country code top-level domain of each APAC territory. Click for details.
  • au : Australia
  • bn : Brunei
  • fj : Fiji
  • hk : Hong Kong
  • in : India
  • id : Indonesia
  • jp : Japan
  • kr : South Korea
  • my : Malaysia
  • nz : New Zealand
  • pk : Pakistan
  • ph : Philippines
  • sg : Singapore
  • lk : Sri Lanka
  • tw : Taiwan
  • th : Thailand
  • vn : Vietnam

Example

File tree with associated files for Singapore.

.
├── .github/workflows/
│   └── scrape-sg-auto.yml
└── mcd-bs4-sg/
    ├── mcd-bs4-sg.py
    └── scraped-data/
        ├── [2022-08-15 03:30:57] mcd-bs4-sg.csv
        └── [2022-08-16 03:31:12] mcd-bs4-sg.csv

2. Workflows and Maintenance Scripts

flowchart LR
    A([scrape-territory-auto.yml])-->B[[Run mcd-library-territory.py]]
    B ==>|output|G[("[timestamp] mcd-library-territory.csv")]
    B -.->|trigger on run|C([inspector.yml])
    C -->D{{Scraping Successful?}} ==>|Yes| E[[Run reset-schedule.py]] 
    D ==>|No| F[[Run reschedule-next-run.py]]
    E -->|next run back at usual time tomorrow| A
    F -->|next run in one hour| A

Scraper workflows:

Automated scraper files, one for each territory, execute its scraper script in a GitHub hosted virtual machine. They are triggered on cron schedules defined in default-schedule.csv.

Maintenance workflows:

inspector.yml : runs after every scraper workflow finishes running to execute scripts depending on the result of the scraper workflow. Click for description of each script.

These scripts edit the cron values in workflow .yml files.

  • reschedule-next-run.py : executes on failure of scraper workflow, ensures scrape reattempt by rescheduling the next run to be one hour from the last scheduled run.

  • reset-schedule.py : executes on success of scraper workflow, resets the schedule back to the original cron value defined in default-schedule.csv.

flowchart LR
    F([update-utcoffset.yml]) -->G[[Run update-utcoffset.py]] -->|Check and update UTC Time, Offset, and Cron|H[(default-schedule.csv)]
    I(User makes changes to default-schedule.csv) --> F
    J(Cron schedule trigger) --> F
update-utcoffset.yml : maintains data accuracy in default-schedule.csv. Triggered on schedule once a day, and when default-schedule.csv is edited. Executes update-utcoffset.py to ensure UTC offset values are current (for Daylight Savings), and UTC Time values (and Cron values) are corrected after user edits are made to Local Time values.

Disclaimer

Use of these scripts is limited only to non-sensitive and publicly available data.

The automated scripts wholly rely on virtual machines hosted by GitHub Actions to execute them. While every effort has been made to ensure timely execution, there have been instances of temporary disruption to GitHub services. Scheduled events are often delayed, more so especially during periods of high loads of GitHub Action workflow runs.

The material embodied in this repository is provided to you "as-is" and without warranty of any kind, express, implied or otherwise, including without limitation, any warranty of fitness for a particular purpose. In no event shall the author be liable to you or anyone else for any direct, special, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including without limitation, loss of profit, loss of use, savings or revenue, or the claims of third parties, whether or not the author has been advised of the possibility of such loss, however caused and on any theory of liability, arising out of or in connection with the possession, use or performance of this repository.