Skip to content

jurkovicmartin/Recipes-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipes-Project

Repository contains a web recipes wrapper. The wrapper consists of scraper, cacher and searcher. Additionally a simple application that utilize the wrapper is also included.

Wrapper

Utilities

Scraper Scrapes recipe information from the web for further processing. Additionally, the scraper provides all available recipes within the source. Every source site has its own scraper.

Current version has implemented only one source (https://www.allrecipes.com)

Scraped info:

  • Title

  • Metadata - such as required time, servings, ...

  • Ingredients

  • Instructions

  • Rating - value and ratings count

  • URL - the source

Cached recipes also contain time mark.

Cacher Scraped recipes are saved to local cache as json files. If the recipe is requested again it is loaded from this local cache. The cacher handles saving, loading, validating. Validating means that each cached file has set a TTL (Time To Live). If the file is loaded after the TTL it is considered as invalid and the recipe is scraped again, followed by creation of a new cache file.

Searcher Searcher handles recipes searching. As mentioned before, the scraper provides list of all available recipes from its source. Based on this list an inverted index is built. This index contains keywords and corresponding recipes url.

When searching query is provided it is divided into keywords as well and then compared to keywords in the searching index. The resulting list of recipes is formed as intersection of all the urls of each query keyword.

Project scheme

Functionality

Wrapper handles the recipe as dictionary. It provides functionalities and outputs of partial utilities (described above) such as returning searched recipes. Additionally, the wrapper is processing the scraped recipe. It formats it, which include for example converting all numeric value to an actual numeric data types.

Extended functionality includes changing the servings size which results in recalculating all of the ingredients.

The example is a json representation of a dictionary.

An example of a recipe can be found in example.

Application

To utilize the wrapper an example application is included. The app allows user to:

  • Search for recipe

  • Display it

  • Change servings

  • Export the recipe as .txt

Application UI is done with CustomTkinter package

Application showcase

Improvements

Possible future improvements include:

  • Search results with more info - for possible filtering

  • Include more recipes site (sources)

  • Ingredients units converter (cups <-> grams)

  • Further testing and debugging of the combination of the scraper and wrapper (all recipes do not have the same information fields)

About

Wrapper for recipes from web.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages