This project is a fully automated, easily re-themable virtual influencer that fetches the latest news in a specific niche, generates a narrated video, and uploads it to YouTube.
- Fetches real news using NewsAPI (free tier)
- Summarizes news using OpenAI GPT (optional, free tier)
- Generates video using gTTS (free) and moviepy (free)
- Uploads to YouTube (requires free OAuth setup)
- Easily change the niche/topic in
.env
pip install -r requirements.txt
NEWS_API_KEY=your_newsapi_key
YOUTUBE_API_KEY=your_youtube_api_key # (not used, but reserved)
VIDEO_GEN_API_KEY=your_video_gen_api_key # (not used, but reserved)
GOOGLE_APPLICATION_CREDENTIALS=client_secret.json # Path to your YouTube OAuth credentials
YOUTUBE_CHANNEL_ID=your_channel_id
NARRATOR_VOICE=default
NICHE="Australian immigration news"
VIDEO_TITLE="Australian Immigration News"
KEYWORDS="Australia immigration,Australia permanent visa,Australia visa 190,Australia visa 186,Department of Home Affairs Visa Processing Time,Australia skilled migration,Australia PR changes,Australia migration update"
POST_SCHEDULE="0 9 * * 1,4"
OPENAI_API_KEY=your_openai_api_key # Optional, for better summarization
- Get a free NewsAPI key at https://newsapi.org by registering for an API key and updating
NEWS_API_KEY
- For YouTube upload, in Google Cloud Console APIs Credentials, create "OAuth" credentials for desktop app (select External for User Type), download
client_secret.json
, and save it asclient_secrets.json
in the project root directory.- Enable the YouTube Data API v3, still in Google Cloud Console.
- Update
YOUTUBE_API_KEY
with your Google YouTube API key - Add your YouTube channel ID to
YOUTUBE_CHANNEL_ID
- (Optional but recommended) Get an OpenAI key at https://platform.openai.com/ and update
OPENAI_API_KEY
python main.py # or python3 main.py
- The script will fetch news, generate a summary, create a video, and upload (or simulate upload) to YouTube.
- The output video will be
output_video.mp4
.
- Edit the
NICHE
variable in.env
to any topic (e.g., "crypto news", "AI breakthroughs", etc.). - Update the
VIDEO_TITLE
to match your niche (e.g., "Crypto Daily Updates", "AI News Weekly"). - Customize the
KEYWORDS
with comma-separated search terms relevant to your niche (e.g., "Bitcoin,Ethereum,cryptocurrency,crypto market,blockchain"). - The bot will fetch and summarize news for the new topic automatically.
- Use
crontab
or a Python scheduler to run the bot twice a week as desired.
Pierre-Henry Soria. A super passionate engineer who loves automating content creation efficiently!
Enthusiast of YouTube, AI, learning, and researching! Find me at pH7.me
Enjoying this project? Buy me a coffee (spoiler: I love almond extra-hot flat white coffees).
Enjoy your automated virtual influencer!