GithubHelp home page GithubHelp logo

afwolfe / python-allrecipes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from remaudcorentin-dev/python-allrecipes

0.0 0.0 0.0 17 KB

Python API to search & get recipes from the 'allrecipes.com' website (web crawler, unofficial)

License: MIT License

Python 100.00%

python-allrecipes's Introduction

python-allrecipes

v0.3.1
News : package now up to date on 2023-02-20 to include recent 'allrecipies.com' website html changes + fix SSL issue

Python API to search & get recipes from the 'allrecipes.com' website (web crawler, unofficial)
Useful, efficient and super simple to use.

Installation :

pip install python-allrecipes==0.3.1

Requirements :

python >= 3.4
beautifulsoup4 >= 4.6

API References

AllRecipes.search return a list of dictionary like :
  • name: name of the recipe.
  • url: url of the detailed recipe on 'allrecipes.com'.
  • image: if exists, image of the recipe.
  • rating: average rating given to the recipe (float 0 - 5, None if does not exist)
AllRecipes.get return a dictionary like :
  • rating: average rating given to the recipe (float 0 - 5, None if does not exist)
  • ingredients: string list of the recipe ingredients (including quantities)
  • steps: string list of each step of the recipe
  • prep_time: Estimated preparation time of the recipe (>= 0.1.6)
  • cook_time: Cooking time (>= 0.1.6)
  • total_time: Estimated total time of the recipe (>= 0.1.6)
  • nb_servings: Estimated number of servings for the recipe (>= 0.3.1)

Usage / Example:

from allrecipes import AllRecipes

# Search:
search_string = "pork curry"  # Query
query_result = AllRecipes.search(search_string)

# Get:
main_recipe_url = query_result[0]['url']
detailed_recipe = AllRecipes.get(main_recipe_url)  # Get the details of the first returned recipe (most relevant in our case)

# Display result:
print("## %s:" % detailed_recipe['name'])  # Name of the recipe

print("### For %s servings:" % detailed_recipe['nb_servings'])
for ingredient in detailed_recipe['ingredients']:  # List of ingredients
    print("- %s" % ingredient)

for step in detailed_recipe['steps']:  # List of cooking steps
    print("# %s" % step)

Notes:

Since version 0.3:

  • Search only supports text as other options are not avilable on allrecipes website anymore,
  • 'description' from the search result is not available anymore as it is not returned on search by allrecipes anymore

OnGoing features :  

  • Preparation time, Cooking time, Total time (available in 0.1.6)
  • Calories counter / Nutritionals apports
  • Multiple images returned for the search / get requests
  • Limit the number of returned query on search
  • More returned data & query options

Related projects :

Support / Contact : [email protected]

python-allrecipes's People

Contributors

remaudcorentin-dev avatar peteryangio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.