Automated Shinobi is a fully automated pipeline that generates short YouTube videos featuring rare and interesting facts about Anime like Naruto, Bleach, and Attack on Titan. The project is built entirely using Python with a modular coding approach.
- Fact Generation: Uses the Gemini API to generate rare and interesting facts about the selected anime series.
- AI Voiceovers: Converts the generated fact into speech using the Speechify API.
- Image Fetching: Uses the DuckDuckGo API to retrieve relevant images based on the generated fact.
- Video Compilation: Leverages the MoviePy module to merge the background music (BGM), images, and AI-generated voiceovers into a short video with animations.
- Subtitle Generation: Uses OpenAI's Whisper module to create subtitles based on the generated voiceover.
- Metadata Generation: Gemini API is used again to generate an appropriate title, description, and tags for the video.
- YouTube Upload: Utilizes the YouTube API to upload the generated video along with the metadata.
- Automation (Optional): The workflow can be automated using GitHub Actions, but the script can also be executed manually.
The project requires the following dependencies, specified in requirements.txt
:
numpy
pandas
google-generativeai
python-dotenv # For managing environment variables
duckduckgo_search
openai-whisper
opencv-python-headless # Optimized for servers (instead of opencv-python)
moviepy==1.0.3
tqdm
Pillow # Correct package name for PIL
google-auth
google-auth-oauthlib
google-auth-httplib2
google-api-python-client
imageio[ffmpeg] # Ensures ffmpeg support for MoviePy
Before running the project, create a .env
file in the root directory and paste the following:
GEMINI_API_KEY=your_actual_gemini_api_key
SPEECHIFY_API_KEY=your_actual_speechify_api_key
API_URL=your_actual_api_url
MIN_IMAGES=20
GOOGLE_API_KEY=your_actual_google_api_key
GOOGLE_CSE_ID=your_actual_google_cse_id
YT_CLIENT_ID=your_actual_yt_client_id
YT_CLIENT_SECRET=your_actual_yt_client_secret
YT_PROJECT_ID=your_actual_yt_project_id
YT_AUTH_URI=your_actual_yt_auth_uri
YT_TOKEN_URI=your_actual_yt_token_uri
YT_REDIRECT_URI=your_actual_yt_redirect_uri
YT_REFRESH_TOKEN=your_actual_yt_refresh_token
Make sure to replace your_actual_*
values with your real API keys. The .env
file is used to store sensitive information securely and should not be committed to version control. You can add .env
to your .gitignore
file to prevent accidental commits.
- Fact Generation: The script fetches a random interesting fact using the Gemini API.
- Voiceover Creation: Converts the text into speech using the Speechify API.
- Image Fetching: Searches for relevant images using the DuckDuckGo API.
- Video Compilation: Combines images, BGM, and the voiceover into an animated video.
- Subtitle Generation: Generates subtitles based on the voiceover.
- Metadata Creation: Creates a title, description, and tags using Gemini.
- YouTube Upload: Uploads the video using the YouTube API.
- Execution: The process can be run manually using
python app.py
.
To run the script manually on your local machine:
- Clone the repository.
- Set up API keys and environment variables in a
.env
file. - Install dependencies using
pip install -r requirements.txt
. - Run the script with
python app.py
.
- If you wish to automate the process, configure GitHub Actions (
automation.yml
) to trigger the process on a schedule. - Push the project to GitHub and enable Actions to start automation.
Contributions are welcome! Feel free to fork the repository, create a new branch, and submit a pull request with improvements or new features. 🙌🏻
Happy Coding !