Skip to content

A self-hosted website to search and save Reddit user comment history.

License

Notifications You must be signed in to change notification settings

GabrielNezovic/streamlit-reddit-comment-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamlit-reddit-comment-search

screenshot

A self-hosted website to search and save Reddit user comment history using Python, Streamlit and the Reddit API.


Installation and Setup



Generate a Reddit API 'client_id' and 'client_secret'
  1. Click on Create a new app in the Reddit app console: https://www.reddit.com/prefs/apps
  2. Name the app 'Reddit Comment Search'
  3. Select 'Script' from the list of radio buttons
  4. Add the description 'A python script to search through Reddit comment history."
  5. Use your public IP address as the 'About URL' and the 'Redirect URI'
  6. Confirm your status as a human
  7. The client_id will be the short-ish string of random characters underneath the name of the application
  8. The client_secret will be the "secret" listed under the application when you click on edit application

Once you have your Reddit API details, Update these values in the search.py file:

client_id="XXX"
client_secret="XXX"

Save the search.py file and then use the run.bat file to handle the required dependencies and run the script:

run.bat

The following page will automatically launch in your browser once the dependencies have been installed/checked:

http://localhost:1198/

You can search for a Username, Query the users' comments (blank queries will simply retrieve all comments) and Filter the search for comments made within the last X number of days.

The resulting comments are then individually saved as text files in the 'comments' folder using the filename format:

comment_datestamp - username - query.txt

Troubleshooting

Open TCP Network Port 1198 to allow communication with Streamlit.

Only one copy of run.bat can be running at a time. If run.bat stalls on launch, open task manager and close down any running intances of python.exe and then try run.bat again.


Dependencies


@GabrielNezovic 2023