Skip to content

dybdeskarphet/unixporn-top-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š r/unixporn Top Tags

This script is designed to analyze and aggregate the tags used in post titles on the /r/unixporn subreddit. It fetches posts from Reddit, extracts tags from post titles, normalizes them, and then counts their occurrences, outputting the result in a CSV file

πŸš€ Getting Started

Prerequisites

  • Python 3.x
  • PRAW (Python Reddit API Wrapper)
  • Pandas
  • NumPy
  • Matplotlib
  • python-dotenv

Installation

  1. Clone the repository or download the source code.
  2. Install the required Python packages:
    pip install -r requirements.txt
  3. Set up your Reddit API credentials (see the "Configuration" section below).

Configuration

You need to create a Reddit API application to get your client_id and client_secret. Follow these steps:

  1. Go to Reddit's apps page.
  2. Click "Create App" or "Create Another App".
  3. Fill in the details:
    • Name: Whatever you prefer
    • App type: Choose "script"
    • Description: Optional
    • About URL: Optional
    • Redirect URI: http://localhost:8080 (or another URI of your choice)
  4. Click "Create app".
  5. Note down the client_id (under the app name) and client_secret.

Create a file named .env in the same directory as the script with the following contents:

CLIENT_ID=your_client_id_here
CLIENT_SECRET=your_client_secret_here

πŸ“ Usage

Create the data

Run the script using Python:

python tag_counter.py

The script will fetch data from the subreddit, process it, and output the results in a file named tag_counts.csv.

Create graph from the data

Run the script using Python:

python tag_counter.py

This script will create a horizontal bar graph from the resulting data.

πŸ“š Features

  • Fetches top posts from /r/unixporn for each year since the subreddit's creation.
  • Extracts and normalizes tags from post titles.
  • Counts the occurrence of each tag.
  • Outputs the result in a CSV file for easy analysis.
  • Create a graph from the resulting CSV file.

βš™οΈ Customization

You can customize the script to analyze different subreddits or to change the normalization rules by editing the normalize_tag function.

πŸ“‹ License

This project is open source and available under the GNU GPLv3.

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues page.

🌟 Acknowledgements

Special thanks to the Reddit community and the developers of PRAW for making this project possible.

πŸ“ˆ A graph from January 2024