Giter VIP home page Giter VIP logo

recipe-app-m3's Introduction

RecipeApp

This is an app which implements an algorithm to "scan" a web recipe and extract title, description, ingredients, instructions, image, yield and cook time.

๐Ÿšง This app is currently a work in progress.

โ— At this time the algorithm only works for swedish recipes.

Simplified overview of the "scanning" process:

  • First search the HTML for a script tag with type "application/ld+json" or "application/javascript" which in most cases has all this data in a JSON blob.
  • If this script tag is found then you find the JSON where the field "@type" has value "Recipe" and then it's possible to extract the data.
  • If this script tag is not found then some data can be found in og:XXX meta tags. However ingredients and instructions usually require that you traverse the HTML and find this data by other means:
    • The HTML can be visualized in a tree structure and traversed in a depth first search fashion.
    • All tags are then scored based on a few criteria to find the best matches for ingredients/intructions (see code for exact criteria).
    • The two top scoring nodes for ingredients and instructions respectively are singled out and the LCA (lowest common ancestor) is determined and then all child nodes are considered ingredients/instructions.

Note that this process will fail sometimes however some testing has shown that it's quite rare. Furthermore the algorithm sometimes gives back extra data which is intention as it otherwise might miss some data which is worse - the user can always edit the recipe and delete any extra data.

Some videos of the app in action

Scrape recipe from the web:

recipe-app-web.mp4

Sign in. Detail screen and editing recipe:

recipe-app-recipe.mp4

Different ways of adding a new recipe (you can add from share sheet as well):

recipe-app-add.mp4

Planning meals:

recipe-app-planning.mp4

recipe-app-m3's People

Contributors

matten-rd avatar

Watchers

 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.