Web scraping with Shiny - automate your weekly food order


March 6, 2023

Simple, but useful application of static web scraping in a shiny web application to find your favorites in the menu.

Web scraping with Shiny - automate your weekly food order

Web scraping is a technology that can be used to automatically download data from online pages. It can be used in many areas: collecting data for research, monitoring prices, and automatically reporting any regularly updated online data source. In this fun project, I give an example of the latter.

The menu of Interfood is immense and I usually like to get the weekly order done quickly, so I built a small shiny application for it (Do not laugh, pancakes are really hard to find). Shiny is an application written in R (or Python) that can be stored on an online server, the biggest advantage of which is that it is incredibly easy to create.

The application works as follows: when you open it, it visits the Interfood’s menu for the given week and downloads the entire offer.


read_html("https://www.interfood.hu/etlap-es-rendeles/") |> # download the entire website
    html_nodes(paste0(".cell:nth-child(1) .food-etlap-szoveg")) |> # 1st day
    html_text() |> # format to text
    head() # first 6 item
[1] "Frankfurti leves"            "Frankfurti leves"           
[3] "Zöldborsóleves V"            "Zöldborsóleves V"           
[5] "Tejszínes cseresznyeleves V" "Tejszínes cseresznyeleves V"

After a few cleaning steps, the entire menu is loaded, as if reading it on the web page. The next function of the application is that we can specify which dishes we have rated and which days we would like to order. The Shiny then simply collects the dishes with the highest ratings for the given days and visually displays the recommended order.

This is not a serious data analysis task, but an excellent example of how an application that can be written in seconds can help us in many areas of life and how rewarding coding can be. The full code is available in the follwing GitHub repository just as the link to the app.