From 3f22a0373f89e734f2015e3aa4a7e72c83575408 Mon Sep 17 00:00:00 2001 From: Peisong Xiao Date: Fri, 23 Feb 2024 23:36:52 -0500 Subject: [PATCH] Added coin.org - A description of the project --- coin.org | 17 +++++++++++++++++ upc.py | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 coin.org diff --git a/coin.org b/coin.org new file mode 100644 index 0000000..e87f43d --- /dev/null +++ b/coin.org @@ -0,0 +1,17 @@ +#+TITLE: coin - An inventory manager to keep track of items bought from Walmart (Canada) +#+AUTHOR: Peisong Xiao +#+EMAIL: peisong.xiao.xps@gmail.com +#+OPTIONS: toc:nil date:nil + +* Why coin? +If you'd like to keep track of your groceries, use coin. + +* How does coin work? +First, coins pulls the UPC and price info off of the given Walmart +receipt. + +Then, coin matches the name with the UPC (Yes! No more scratching your +head against seemingly random Walmart abbreviations for items!) using +a scraper + +Finally, it stores your shopping trip in a database. diff --git a/upc.py b/upc.py index 6159ee4..5ad6ced 100644 --- a/upc.py +++ b/upc.py @@ -7,6 +7,9 @@ driver.implicitly_wait(5) def get_name_from_upc(upc: str) -> str: url = "https://stocktrack.ca/wm/index.php?s=wm&upc=" + upc driver.get(url) + + # Change the cookies here to match that of yours when you lookup + # any item on stocktrack.ca to bypass the Cloudflare checks driver.add_cookie({ "name": "PHPSESSID", "value": "835ttgvbgncf4uq82dpagmk688", @@ -25,6 +28,7 @@ def get_name_from_upc(upc: str) -> str: "path": "/", "domain": "stocktrack.ca" }) + driver.refresh() name = "" str_s = "target=\"_blank\">"