TrendsGPT
📈 TrendsGPT: An AI-powered tool harnessing OpenAI's GPT-4 to automate market research and data analysis. Fetches trending topics from Reddit, analyzes sentiment, extracts insights, fact checks on google trends and recommends creative content.
Install / Use
/learn @theailifestyle/TrendsGPTREADME
TrendsGPT
TrendsGPT is an automated AI agent designed for data analysis and market research. It identifies trending news articles from Reddit, determines sentiment, extracts article content, identifies key trending keywords, and even suggests T-shirt ideas based on the article content!
Table of Contents
- Features
- Requirements
- Installation
- How to Use
- Code Overview
- Function Descriptions
Features
- Sentiment Analysis: Uses OpenAI's GPT-4 to determine the sentiment of Reddit headlines.
- Content Extraction: Extracts the content of selected articles.
- Keyword Identification: Recognizes top keywords from the article content.
- Trend Analysis: Checks the popularity of the identified keywords using Google Trends.
- Idea Generation: Suggests T-shirt ideas based on trending keywords and article content.
Requirements
- Python 3.x
- Praw, OpenAI, Requests, BeautifulSoup4, Pytrends, Pandas
Installation
- Clone this repository:
git clone <repository-link>
- Navigate to the directory and install required Python packages:
cd <repository-name>
pip install praw openai requests beautifulsoup4 pytrends pandas
How to Use
- Set up your API keys:
- For Reddit (
CLIENT_ID,CLIENT_SECRET), get them here. - For OpenAI (
OPENAI_API_KEY), get it from the OpenAI website.
- For Reddit (
- Run the main script:
python <script-name>.py
- Results will be saved in a CSV file named
memeworthy_articles.csv.
Code Overview
The code follows these steps:
- Initialization: Set up Reddit and OpenAI clients.
- Article Collection: Fetch top weekly articles from Reddit's
nbasubreddit. - Sentiment Analysis: Analyze sentiment of headlines using OpenAI.
- Content Extraction: Extract and summarize article content.
- Keyword Identification: Recognize top keywords from the article content.
- Trend Analysis: Analyze keyword popularity using Google Trends.
- Idea Generation: Suggest T-shirt ideas using OpenAI.
- Data Storage: Store all findings in a DataFrame and export it to a CSV.
Function Descriptions
-
get_sentiment(headline):- Input: A string containing a headline.
- Output: Sentiment of the headline ("positive", "neutral", or "negative").
- Uses OpenAI to determine the sentiment of a given headline.
-
fetch_article_content(url, headline):- Input: URL of the article, and its headline.
- Output: Extracted content of the article.
- Uses
requestsandBeautifulSoupto extract article content.
-
get_keywords_from_article(article):- Input: A string containing article content.
- Output: List of top keywords from the article.
- Uses OpenAI to identify and extract the top keywords from the provided article content.
-
check_google_trends(keyword):- Input: A keyword string.
- Output: Popularity score of the keyword using Google Trends.
- Utilizes
pytrendsto fetch the trend score of a given keyword.
-
get_tshirt_ideas(keywords, article_text):- Input: List of keywords and the article content.
- Output: T-shirt ideas based on the keywords and article content.
- Leverages OpenAI to suggest T-shirt ideas.
-
get_article_summary(article):- Input: A string containing article content.
- Output: Summarized version of the article.
- Uses OpenAI to generate a concise summary of the given article content.
Note
Please be mindful of API rate limits, especially when making frequent requests.
Related Skills
feishu-drive
354.2k|
things-mac
354.2kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
354.2kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
postkit
PostgreSQL-native identity, configuration, metering, and job queues. SQL functions that work with any language or driver
