cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Direct import of json recipe

Open Ultchad opened this issue 2 years ago • 11 comments

Would it be possible to directly import json files? (Example from your git)

Failing website: https://raw.githubusercontent.com/nextcloud/cookbook/1c60fc03cda4c4af3e650637d5f3b22101e37c6f/tests/Unit/Helper/HTMLParser/res_JsonLd/caseJ.json

Checking if valid metadata are present: [x] Yes, I check the source code of the website and found metadata. it's directly the json shema

Cookbook version: 10.2

Problem description (if applicable): The page cannot be imported. The error message is: "No parser found for the given import."

Thanks for this project!

Actualy i create an empty recipe (from your app) and i edit the recipe.json (of the new recipe) with the json schema I found

Ultchad avatar May 15 '23 09:05 Ultchad

Yes, in general it is possible. One has to wipe a new importer class. This should not be too much effort, i guess. I have to check, though.

May i ask why you try to import directly? Is there a page that offers the JSON files explicitly?

christianlupus avatar May 16 '23 04:05 christianlupus

The recipe page loads the json file from a network call and I get the url of the json. Other pages have 2, when loading the page a script get the json via the network, then integrates it into the page (the cookbook import does not currently work on it, i have the same error, i can create other issue later for this site)

Ultchad avatar May 16 '23 10:05 Ultchad

May i ask why you try to import directly? Is there a page that offers the JSON files explicitly?

ChatGPT is great at reformatting recipes to schema.org format. I've been manually adding recipes to the nextcloud filesystem with it but it would be amazing if I could just paste in the json.

doguitar avatar Jun 13 '23 17:06 doguitar

https://github.com/hhursev/recipe-scrapers can already scrape dozens of websites into schema.org format, so this feature would make it very easy to integrate with that. Exposing the import function somehow so that it is callable would be even better :)

magarnicle avatar Jun 26 '23 22:06 magarnicle

Would certainly be a great feature I have used Chatgpt to reformat an unstructured recipe into schema .org format to get output like (see below). To be able to import this directly, would be ideal.

gewinh avatar Oct 16 '23 06:10 gewinh

Okay, to be honest I am a bit unsure if I understand you correctly of if this is in fact two feature requests.

@Ultchad, @gewinh, and all the others involved: what exactly are you looking for, a dringend it a backend solution? That is, do you want to have an UI text field where you can copy and paste e.g. the output of ChatGPT? Or are you missing an option to allow the parser to detect plain JSON+LD files directly?

My original interpretation was the latter (assignment the parser capabilities). Please clarify, we might open another issue if needed.

christianlupus avatar Oct 29 '23 06:10 christianlupus

My request was more the latter - I was trying to migrate from a different service and I had to create HTML files that wrapped the JSON, stand up a web server to serve them so that Cookbook could import them. Pointing Cookbook and the JSON files would have skipped a bunch of steps. An API or command-line call to import a batch of recipes would be even better but more work, obviously.

magarnicle avatar Oct 29 '23 23:10 magarnicle

do you want to have an UI text field where you can copy and paste e.g. the output of ChatGPT?

This is what I am looking for. As of now, my process has been to copy schema.org formatted recipes into a .json file and create a folder with my recipe title in my nextcloud filesystem for it.

However, just being able to upload a .json file directly would be a huge improvement in this regard, imo.

doguitar avatar Oct 30 '23 16:10 doguitar

@magarnicle the current API should be capable of creating new recipes by uploading the JSON data plainly. I guess there is nothing fancy needed for this requirement.

@doguitar I would keep your request separately as it is related to UI while the other two parts are more backend oriented.

christianlupus avatar Oct 30 '23 21:10 christianlupus

Thanks for the follow up. Either import a JSON file or cut and paste it to the ui would be great.

gewinh avatar Oct 31 '23 05:10 gewinh

Okay, to be honest I am a bit unsure if I understand you correctly of if this is in fact two feature requests.

@Ultchad, @gewinh, and all the others involved: what exactly are you looking for, a dringend it a backend solution? That is, do you want to have an UI text field where you can copy and paste e.g. the output of ChatGPT? Or are you missing an option to allow the parser to detect plain JSON+LD files directly?

My original interpretation was the latter (assignment the parser capabilities). Please clarify, we might open another issue if needed.

Actualy it's for import directly (with the field to download a recipe from an URL in webui) a JSON file, by giving the url like my example

Sorry for my late response Your other proposal is interesting and I just had a use case today, I am going to do the import by hand by creating the files. I think this feature will require another request

Ultchad avatar Nov 16 '23 17:11 Ultchad