BLUF - I made a web crawler to write food prices to a spreadsheet
With the advent of online grocery delivery, I wondered which company provided the cheapest green onions and ground turkey. I initially made a Google Spreadsheet to organize my findings, but later decided to automate updates.
Grocery Deals is a Python web-scraping tool that automatically visits supermarket websites, extracts all the prices for various food items, and writes it to a Google Spreadsheet. This automated software tool enables users to quickly find the lowest prices in order to make an informed decision about where to shop for food. Websites for Amazon Fresh, Weee, and Ralphs are accessed by the tool. The location that has the cheapest price for the most common goods is highlighted in the spreadsheet, clearly indicating the best place to visit for those on a tight budget, especially students.
Building a web crawler uses the following libraries:
Beautiful Soup
Known as bs4, this library enables web URLs to be accessed and have their corresponding contents parsed. Specific features on a website like the header, price tags, and images can be identified with this library as it can inspect each element.
pygsheets
An open source application programming interface (API) that allows Python to interact with a spreadsheet hosted on the cloud. Pygsheets can download, edit, and reupload sheets to a Google Spreadsheet file.
Pandas
A popular library for handling tensors of mixed variable type data, where numbers and strings can be recorded into cells. Pandas directly generates a data frame which can then be converted to a page on a Google Spreadsheet.
A streamlined, end-to-end process for scraping websites selling groceries was developed.
The software tool automatically visits links to popular food items to ranking their prices
It enables users to quickly see at a glance which store sells the cheapest version of an item.
Not only does the tool check goods sold in bulk and derive the unit price, it also can check the websites dynamically to capture discounts that come and go on a daily basis.
Grocery Deals web-scraping tool offers a seamless solution for consumers seeking the best prices on food. Utilizing libraries such as bs4, pygsheets, and Pandas, the tool automates the process of extracting and organizing price data from various supermarket websites. This enables users to easily identify the cheapest options for common food items, enhancing their ability to make informed shopping decisions. Grocery Deals proves to be a valuable resource for budget-conscious individuals, including students, seeking to optimize their grocery expenses.