JoTec2002 / InstagramToMealie

A simple little converter, that imports an instagram URL into mealie
MIT License
20 stars 1 forks source link

Error while getting Recipe from API! #3

Closed joestump closed 3 hours ago

joestump commented 4 hours ago

Issue

Saw your post about your project and took it for a spin – thank you for this! This is a must-have feature for my partner. I've tried a couple of URLs and keep getting:

Exception('Error while getting Recipe from API! - Status Code: 400 - Response: {"detail":{"details":"BAD_RECIPE_DATA"}}')

URLs tested:

Logs

https://mealie.example.com
Mealie API Key is set in ENV
INSTA_USER is set in ENV
Session file exists
120
Checking connection and validating auth data...
Connection established! Auth data validated! - Status Code: 200
Loaded session from ./session-file.
my-ig-username
Startup Successfully
downloads/C1z7vrISv4w/2024-01-07_19-54-55_UTC.jpg [One of my most viral recipes …] downloads/C1z7vrISv4w/2024-01-07_19-54-55_UTC.mp4 
Downloaded post: https://www.instagram.com/reel/C1z7vrISv4w/
downloads/C1nZam7S31q/2024-01-02_23-02-36_UTC.jpg [Chicken kofta with tzatziki a…] downloads/C1nZam7S31q/2024-01-02_23-02-36_UTC.mp4 
Downloaded post: https://www.instagram.com/reel/C1nZam7S31q/?igsh=eHlsd3Z3bjg1dDBn
joestump commented 4 hours ago

I added some debug output and this is what's getting the BAD_RECIPE_DATA response:

{"includeTags": true, "data": "Chicken kofta with tzatziki and lemon dill rice\u2728\nCre by @maxiskitchen\nFor the Chicken Kofta:\u25aa\ufe0f1 lb. Ground Chicken (96% lean, not breast only)\u25aa\ufe0f1/2 Cup Yellow Onion, finely chopped\u25aa\ufe0f1/4 Cup Parsley, finely chopped\u25aa\ufe0f2 Tbsp Mint, finely chopped\u25aa\ufe0f3 Cloves Garlic, minced\u25aa\ufe0f1 Egg\u25aa\ufe0f1 Tbsp Coriander\u25aa\ufe0f1+1/2 tsp Cumin\u25aa\ufe0f1/2 tsp Cinnamon\u25aa\ufe0f1/4 tsp Cayenne Pepper\u25aa\ufe0f1 Pinch Cloves\u25aa\ufe0f1/4 tsp Black Pepper\u25aa\ufe0f1 tsp Kosher Salt\u25aa\ufe0f1 Tbsp Avocado or Olive Oil\u25aa\ufe0f\n\nFor the Tzatziki: \u25aa\ufe0f1/2 a Large Cucumber, grated\u25aa\ufe0f2 Cups 2% Greek Yogurt\u25aa\ufe0f1 Clove Garlic, grated or minced\u25aa\ufe0f1 Lemon, juice\u25aa\ufe0f1 Tbsp Olive Oil\u25aa\ufe0f1/4 tsp Kosher Salt (or to taste)\u25aa\ufe0f\n\nFor the Lemon Dill Rice:\u25aa\ufe0f2 Cups Chicken Stock\u25aa\ufe0f1/2 tsp Salt\u25aa\ufe0f1 Clove Garlic, minced\u25aa\ufe0f1 Cup Long-Grain Rice\u25aa\ufe0f1 Medium Lemon, zest (~1 Tbsp)\u25aa\ufe0f2 Tbsp Fresh Dill, chopped\u25aa\ufe0f2 Tbsp Butter\u25aa\ufe0f\n\nSliced Veggies (for serving):\u25aa\ufe0f1/2 a Cucumber, sliced\u25aa\ufe0f1/4 of a Yellow Onion, sliced\u25aa\ufe0f1 Tomato, sliced\u25aa\ufe0f\n\n1\ufe0f\u20e3 Mix together ingredients for the tzatziki and set aside in the fridge\n2\ufe0f\u20e3 To make the lemon dill rice, add the chicken stock, salt, and garlic to a small pot and bring to a boil; stir in the rice and then turn the heat down to low and cover and simmer for 20 mins (or until all liquid is absorbed); turn off the heat and stir in the lemon zest, dill, and butter\n3\ufe0f\u20e3 For the chicken kofta, combine the ground chicken, onion, parsley, mint, garlic, egg, coriander, cumin, cinnamon, cayenne, cloves, salt, and pepper in a large bowl\n4\ufe0f\u20e3 Preheat a large nonstick skillet over medium heat and add 1 Tbsp oil; place dollops of the chicken mixture (~1 heaping Tbsp each) onto the pan and cook for 2-3 minutes until browned; flip over and flatten slightly with the spatula, and cook for another 2-3 minutes until internal temp reaches 165F; repeat until all chicken is cooked\n5\ufe0f\u20e3 Serve chicken kofta with lemon dill rice, tzatziki, and sliced veggies and enjoy!\n\n\ud83d\udd5240 minute total prep + cook time\nRecipe serves 2 people (rice and tzatziki can stretch to 4 people)\n\nFollow @mediterranean.diet.plan to get more daily recipes"}
joestump commented 3 hours ago

Okay, figured out the issue. I set the OPENAI_BASE_URL in Mealie to "", which the docs would suggest means it'll default to OpenAI's API. Instead it'll just try connecting if the env var is set regardless of value.

I'm happy to report this is now working! 🎉