Building AI agents, atomically
YouTube Recipe Extractor
This directory contains the YouTube Recipe Extractor example for the Atomic Agents project. This example demonstrates how to extract structured recipe information from cooking videos using the Atomic Agents framework.
Getting Started
To get started with the YouTube Recipe Extractor:
Clone the main Atomic Agents repository:
git clone https://github.com/eigenwise/atomic-agentsNavigate to the YouTube Recipe Extractor directory:
cd atomic-agents/atomic-examples/youtube-to-recipeInstall the dependencies using uv:
uv syncSet up environment variables:
Create a
.envfile in theyoutube-to-recipedirectory with the following content:OPENAI_API_KEY=your_openai_api_key YOUTUBE_API_KEY=your_youtube_api_keyTo get your YouTube API key, follow the instructions in the YouTube Scraper README.
Replace
your_openai_api_keyandyour_youtube_api_keywith your actual API keys.Run the YouTube Recipe Extractor:
uv run python youtube_to_recipe/main.py
File Explanation
1. Agent (agent.py)
This module defines the YouTubeRecipeExtractionAgent, responsible for extracting structured recipe information from cooking video transcripts. It extracts:
- Recipe name and description
- Ingredients with quantities and units
- Step-by-step cooking instructions
- Required equipment
- Cooking times and temperatures
- Tips and dietary information
2. YouTube Transcript Scraper (tools/youtube_transcript_scraper.py)
This tool comes from the Atomic Forge and handles fetching transcripts and metadata from YouTube cooking videos.
3. Main (main.py)
The entry point for the YouTube Recipe Extractor application. It orchestrates fetching transcripts, processing them through the agent, and outputting structured recipe information.
Example Output
The agent extracts recipe information in a structured format including:
- Detailed ingredient lists with measurements
- Step-by-step cooking instructions with timing and temperature
- Required kitchen equipment
- Cooking tips and tricks
- Dietary information and cuisine type
- Preparation and cooking times
Customization
You can modify the video_url variable in main.py to extract recipes from different cooking videos. Additionally, you can adjust the agent's configuration in agent.py to customize the recipe extraction format or add additional fields to capture more recipe details.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your enhancements or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.