aidiss / barbora-delivery-spot-alert

Tool that signals when delivery spot opens
GNU General Public License v3.0
12 stars 9 forks source link

barbora-delivery-spot-alert

Tool that signals when delivery spot opens

This repository is for educational purposes only.

As a reaction to COVID-19 pandemic a lot of Lithuanian would like to shop online.

Unfortunately most popular online supermarket BARBORA.lt is not able to address rising demand.

This repository contains an example script that could help you to get signal when there are open delivery timeslots.

Instalation

Requires Python > 3

pip install -r requirements.txt

Android Instalation using Termux

Google Play https://play.google.com/store/apps/details?id=com.termux

pkg up

pkg install python

pkg install sox

termux-setup-storage

Change main.py to "play -q -n synth 1 sine 1000 vol 0.1"

Copy all the repo files with the extracted json file to the phones root directory

cd storage/barbora-delivery-spot-alert/

pip install -r requirements.txt

Then, run python main.py alarm headers.txt.json

Enable termux wakelock in notification bar

Usage

Get Headers

  1. Visit www.barbora.lt
  2. Enter devtools (F12)
  3. Choose Network tag
  4. Choose a delivery address/pickup in website
  5. (absolete) Check devtools, right click on any line and select "Save all as HAR"
  6. Check devtools, right click request title "deliveries" select "Save request Headers"
  7. Put headers to file (for example "header") in the same directory as main.py

Running

Run it terminal:

python main.py parse-header header.txt

It extracts header data into header.txt.json and checks for available slots.

If extracted header.json already exists, then run it as:

python main.py alarm header.json

Everytime script finds a slot it text or beep.

Argument list

Argument Alias Value Description
command - { parse-har, parse-header, alarm } Reads input file based on command.
"parse-har" for parsing har file.
"parse-header" for txt file with header.
"alarm" uses already parsed header.
path - - Path to input file with header data
--run-once -o - Run check up ONCE
--verbose -v - Verbose logging


Web app

There is a flask web app at ./app.py To run dev server use

python app.py headers.txt

headers.txt should be a raw headers file copied form developers console

Version tracker

OS support