TweetCraft is a Python script designed to automate the process of creating and posting enriched tweets. It leverages the OpenAI API to summarize web content and generate related images, then posts these summaries along with the images to Twitter, enhancing user engagement with visually appealing, informative tweets.
TweetCraft is based on Kesha Williams' "Building a Project with the ChatGPT API" LinkedIn Learning course - check out that repository here.
- Content Summarization: Utilizes OpenAI's GPT model to generate concise summaries of web content.
- Image Generation: Uses OpenAI's DALL-E to create images that complement the text summaries.
- Tweet Automation: Automatically posts tweets with text, images, and links to the original content.
Before you can run TweetCraft, you'll need:
- Python 3.x
- OpenAI API key
- Twitter Developer account and authentication credentials (API key, API secret key, Access token, Access token secret)
- Installation of the following Python packages:
openai,tweepy,python-dotenv,requests.
Clone the repository:
git clone https://github.com/yourusername/TweetCraft.gitNavigate to the script directory:
cd TweetCraftInstall required Python packages:
pip install -r requirements.txt- Create a
.envfile in the root directory of the project. - Add the following lines to the
.envfile, replacing placeholders with your actual keys:OPENAI_API_KEY='Your_OpenAI_API_Key' CONSUMER_KEY='Your_Twitter_Consumer_Key' CONSUMER_SECRET='Your_Twitter_Consumer_Secret' ACCESS_TOKEN='Your_Twitter_Access_Token' ACCESS_TOKEN_SECRET='Your_Twitter_Access_Token_Secret'
To run TweetCraft:
python tweetcraft.pyFollow the prompts to input the URL you want to summarize and tweet.
Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.
Distributed under the MIT License. See LICENSE for more information.