Skip to content

A twitter bot that tweets out technology related news articles everyday.

Notifications You must be signed in to change notification settings

AMadharha/Daily-Tech-News

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daily-Tech-News

LinkedIn

Twitter Account: https://twitter.com/DailyTechnoNews

Project Description

This is a twitter bot that tweets out technology-related news from the subreddit r/technews. It uses the Tweepy and PRAW to use the twitter and reddit API's to send and recieve information. Additionally, it uses ChatGPT to create summaries of the articles.

Functionality

Tweets:

# Build the tweet content 
article_title = reddit_wrapper.get_top_post_title(time='day', subreddit='technews')
article_url = reddit_wrapper.get_top_post_url(time='day', subreddit='technews')
tweet_content = f'{article_title} {article_url}'

# Tweet out the content
twitter_wrapper.tweet(tweet_content)

It tweets out the top article of today from the subreddit r/technews. The bot tweets at 6:30 AM EST everyday, and since the time filter is by day, duplicates are not a problem.

Here is an example of a tweet by the bot:

tweet image

Replies:

# Build the reply (summary) using ChatGPT
article = Article(article_url)
article.download()
article.parse()

prompt = f'Summaraize the following article for a tweet, be VERY concise: {article.text}'
reply_content = 'TLDR:\n' + chatgpt.get_response(prompt)
...
# Reply to the tweet
twitter_wrapper.reply_to_recent(reply_content)

The bot uses ChatGPT to create a summary of the article, with the max tokens being set to 55 to ensure the reply tweet content does not exceed to tweet character limit.

Here is an example of a reply by the bot (to the tweet above):

reply image

Project Specifications

  • This project was created and tested using Python version 3.11.3.
  • This project uses the Tweepy version 4.14.0.
  • This project uses the PRAW version 7.7.0.
  • The bot runs automatically using Github Actions.