This Python application automatically generates social media content from YouTube video transcripts. It uses the YouTube Transcript API to fetch video transcripts and OpenAI's GPT model to generate engaging social media posts.
- YouTube video transcript fetching
- Multi-platform content generation (LinkedIn, Twitter, Instagram)
- OpenAI GPT integration for content generation
- User-friendly Streamlit web interface
- Python 3.7+
- OpenAI API key
- Internet connection
- Clone the repository:
git clone https://github.com/yourusername/social-media-agent.git
cd social-media-agent- Create and activate a virtual environment:
# Windows
python -m venv .venv
.venv\Scripts\activate
# Linux/Mac
python3 -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your OpenAI API key:
OPENAI_API_KEY=your_api_key_here
- Run the Streamlit app:
streamlit run app.py-
Open your browser at http://localhost:8501
-
In the web interface:
- Enter a YouTube video ID (the part after 'v=' in a YouTube URL)
- Select the target social media platform
- Click "Generate Content" to create your post
- Run the script:
python social_media_agent.py- The script will:
- Fetch the transcript from the specified YouTube video
- Generate social media content for different platforms
- Display the generated content
You can modify the following in social_media_agent.py:
- Video ID: Change the
video_idvariable in themain()function - Social media platforms: Modify the
platformslist in themain()function - OpenAI model: Change the
modelparameter ingenerate_social_media_content()
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.