Skip to content

Fetch the latest news and generate a video in After Effects automatically with this project.

License

Notifications You must be signed in to change notification settings

leonardogrig/video-generator-with-news-fetcher

Repository files navigation

Video Generator With News Fetcher, AI Headline Reader, and Video Composition

Hi there! I'm Leonardo Grigorio Araujo, welcome to my video generator project!

This project uses the "NewsAPI" API to fetch the latest news on a specific topic, convert these news articles into audio files, and then generate a video composition based on these articles. The project is split into three main parts:

  1. 1_get_news.py: Fetches recent news articles on a particular topic (currently set to "Artificial Intelligence") and writes the top 20 articles (sorted by popularity) to a JSON file. This script uses the NewsAPI to fetch the news.

  2. 2_audio_generator.py: Reads the JSON file generated by 1_get_news.py and converts each news article title and source into an audio file using Artificial Intelligence with the Eleven Labs Text-to-Speech API. The audio files are saved in a directory named "audio".

  3. main.js: This JavaScript file is responsible for generating a video composition based on the audio files and a pool of media files. The script creates a composition for each news article, with the article's title as text and a randomly selected media file as the background.

What can you do with this?

With this project, you can automatically create daily shorts, TikTok, or Instagram reels featuring the most popular news articles on any topic you're interested in. You can even tweak the code to fetch news from specific sources or in specific languages!

Setup and Running

To run these scripts, you'll need API keys from NewsAPI and Eleven Labs. These should be stored as environment variables. You can create a .env file in the root directory of the project with the following entries:

NEWSAPI=<your-newsapi-key>
ELEVENLABSAPI=<your-elevenlabs-key>
VOICE_ID=<voice-id-for-tts>

Then, simply run the scripts in order:

python 1_get_news.py
python 2_audio_generator.py

Next, run the main.js script in Adobe After Effects. Make sure you have your media files (.mp4 format) in the /media directory and intro/outro audio and video files in the /audio and /media/fixed directories respectively.

The generated audio files will be saved in the ./audio directory, and the final video composition will be available in Adobe After Effects.

Careful

Depending on the way you use the information gathered by the NewsAPI you may be infringing copyright laws. I do not take responsibility for the way this code could be used.

Contributions

If you'd like to contribute to this project, please feel free to fork the repository, make your changes, and submit a pull request. Here is my GitHub profile for more information: leonardogrig

I hope you enjoy this project!

Best, Leonardo Grigorio Araujo

About

Fetch the latest news and generate a video in After Effects automatically with this project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published