Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create Recipe From HTML or JSON #4274

Open
wants to merge 16 commits into
base: mealie-next
Choose a base branch
from

Conversation

michael-genson
Copy link
Collaborator

@michael-genson michael-genson commented Sep 26, 2024

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

This PR adds the ability to create a recipe from raw HTML or JSON. We leverage the existing URL scrapers as-is, but bypass calling the target URL and instead provide the HTML/JSON directly (JSON must be in schema.org format, although if OpenAI is enabled it might figure it out regardless).

This is suggested on the create by URL page:
image

Which brings you here:
image

You can put HTML or JSON into that text field, however you may optionally use the JSON editor mode for JSON:
image

The main advantages of this are:

  1. If you have raw HTML or JSON from a local recipe (or if you fed something to OpenAI) you can import it here without spinning up a webserver or similar
  2. If our scrapers fail for some reason (e.g. the target URL has anti-bot protection, or recipes are locked behind a login) you can use this as a workaround

Which issue(s) this PR fixes:

(REQUIRED)

Closes #3224
Closes #2391

Special notes for your reviewer:

I changed some of the "create" route names because they're getting a bit unorganized. All recipe create routes are now under /recipe/create/.... This is a breaking change, so I added it to the migration docs.

Testing

(fill-in or delete this section)

Pytest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant