Since I often browse Instagram for recipes, I wanted a way to save them to my own recipe collection on Tandoor. Getting an Instagram API took me too long, so I decided to use Selenium to scrape the recipe from a provided Instagram post. Since everyone writes their recipes differently and it's almost impossible to parse them all into the required JSON format, I decided to use an LLM. My notebook is not powerful enough to use Ollama for this, so I decided to use DuckAi. To automate the query process, I also used Selenium to interact with the website. When I get all the necessary JSON parts, I combine them and send them to Tandoor using the implemented API.
The problem with LLM's is that they are not deterministic, so the output can be variable in quality. Sometimes you have to adjust the output manually, but in most cases it's good enough to use as is.
Make sure you have python 3.x installed on your system.
Without venv:
git clone https://github.com/doen1el/instagram-to-tandoor.git instagram-to-tandoor
cd instagram-to-tandoor
pip install -r requirements.txt
With venv:
git clone https://github.com/doen1el/instagram-to-tandoor.git instagram-to-tandoor
cd instagram-to-tandoor
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Create an .env
file in the root directory of the project and add the following
BASE_URL_TANDOOR=https://YOUR_TANDOOR_URL
TOKEN_TANDOOR=YOUR_TANDOOR_TOKEN
LANGUAGE_CODE=de (or en, etc.)
You can retrieve your tandoor token by
- Visiting
https://YOUR_TANDOOR_URL/settings/#api
. - Creating a new token using the
write read bookmarklet
and a name of your choice - Copy the token and add it to the
.env
file
BASE_URL_MEALIE=https://YOUR_MEALIE_URL
TOKEN_MEALIE=YOUR_TANDOOR_TOKEN
LANGUAGE_CODE=de (or en, etc.)
You can retrieve your tandoor token by
- Visiting
https://YOUR_TANDOOR_URL/user/profile
. - Creating a new api token with a name of your choice
- Copy the token and add it to the
.env
file
Since Selenium uses the installed web browser, you need to adapt the instagram.py
and duckai.py
files to your browser of choice. The default is Firefox
.
python3 main.py -url [https://www.instagram.com/...] -mode [mealie (m) | tandoor (t)]
or use
python3 main.py -help
for more information.
Feel free to open an issue, pull request, or simply fork the project.
By using this application you accept DuckDuckGo AI Chat ToS
- Dockerize the project
- Create a GUI
- Optimize prompting
- Add more error handling