https://github.com/gordon801/reddit-api-data-req
A simple program that allows the user to perform a data query from the Reddit API, parses the received data, and outputs it as a .csv. (Python)
https://github.com/gordon801/reddit-api-data-req
Last synced: 2 months ago
JSON representation
A simple program that allows the user to perform a data query from the Reddit API, parses the received data, and outputs it as a .csv. (Python)
- Host: GitHub
- URL: https://github.com/gordon801/reddit-api-data-req
- Owner: gordon801
- Created: 2021-08-01T03:04:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-01T17:29:44.000Z (almost 4 years ago)
- Last Synced: 2025-01-21T20:09:03.770Z (4 months ago)
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reddit API Data Request with User Input
## Overview
This program allows for user input in the format "{subreddit}, {number of posts}, {timeframe}, {sort category}", and queries the reddit API for the specified data. It parses the returned JSON file and outputs the data as a .csv file. Requested parameters (column variables) can be changed within the code.* subreddit: A specific sub-section of reddit, e.g. r/python (https://www.reddit.com/r/Python/).
* number of posts: The number of posts you want returned, e.g. 100.
* timeframe: The timeframe from which you want posts you returned (i.e. hour, day, week, month, year, all).
* sort category: The sorting method you want to pick posts from over the timeframe (i.e. controversial, best, hot, new, random, rising, top). More information about it here: https://www.reddit.com/r/help/comments/94q9hk/what_is_the_difference_between_the_6_types_of/.## Program Files
* reddit-api-first.py: Contains the code performing the above function.
* Reddit-all-100-year-top_02082021.csv: An example output for the query "all, 100, year, top". Output file name is saved in the format "Reddit-{subreddit}-{number of posts}-{timeframe}-{sort category}\_{current date}".## Example: Requesting "all, 100, year, top"
This request is for the top 100 posts over the last year from the subreddit "all". Resultant output: