

GitHub - Bkyn/reddit-hot-recorder: Records the activity (comments and karma) on...
source link: https://github.com/Bkyn/reddit-hot-recorder
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

reddit-hot-recorder
What is it?
- My first published python project :)
- A script that collects metadata from a Reddit's subreddit hot section, at regular intervals, and turns it into a serie of charts, to be animated.
Here is an extract of a recording of r/all:
How does it work?
- The hotcollect module takes care of collecting the data and can save it into a json.
- The hotplot module uses the collected data to generate a serie of charts.
- The final step requires a software to turn the serie of charts (.png files) into a movie or a .gif.
required:
- matplotlib
- numpy
- PRAW
Examples:
from hotcollect import collect_data
from hotplot import plot_collec
data_collec = collect_data(sub='france',maxposts=10,interval_sec=30,
duration_min=5,feedback=True,savefile='france.json')
plot_collec(data_collec)
- This script will watch the top 10 posts of r/france during 5 minutes, every 30 seconds.
note: You should not go belowinterval_sec=10
as it takes a couple of seconds for the API to collect the data. - It will save the collected data in france.json.
- It will print the following feedback:
1/10 snapshot recorded on Nov 16 2017 11:37:37
2/10 snapshot recorded on Nov 16 2017 11:38:09
plot_collec(data_collec)
will generate 10 .png to be turned into a .mp4.
On linux, I use ffmepg to turns the serie of .png into a .mp4, as follow:
ffmpeg -start_number 1 -framerate 24 -i %04d.png output.mp4
If your local time doesn't match the local time of your viewers, you can correct the timestamp of your collected data by using offset_timestamp(data_collec, delta_hours)
.
For example, if I live in Europe and want to plot for american viewers (-7 hours compared to my local time):
from hotcollect import collect_data, offset_timestamp
from hotplot import plot_collec
data_collec = collect_data(sub='all',maxposts=10,interval_sec=30,
duration_min=5,feedback=False)
for data in data_collec:
data = offset_timestamp(data, -7)
plot_collec(data_collec)
And finally:
- feel free to comment my code, declare issues, propose changes, etc.
It was a learning exercise for me, both on Python and on using GitHub. - it's under MIT licence which mean that you can do whatever you want with it, if I understood correctly.
Don't do evil though, if ever you find a way to do evil things with it...
Recommend
-
13
Coin News Bitcoin, Binance & ETH: Breaking New Records in Bullish ActivityIt would seem the bulls are winning the race at the moment as Bitcoin bags all-t...
-
9
Android Layout: comments activity similar to Facebook advertisements I have been looking at Facebook comment activity: I keep wondering how...
-
10
Ultimate Beginner's Guide to Proxmox GPU Passthrough mirror of The Ultimate Beginner's Guide to GPU Passthrough (P...
-
10
Reddit Adds GIFs in Comments for All Subreddit Communities Published July 13, 2022 By
-
5
August 18, 2022 ...
-
4
Big Dataset: All Reddit Comments – Analyzing with ClickHouse Back to the Blog In this blog, I’ll use ClickHouse and Tabix to look at a new very...
-
15
The Power Delete Suite can help you scrub your Reddit posts and comments in minutes...
-
4
Reddit Adds Images in Comments for Selected Communities Published Dec. 2, 2022 By And...
-
7
Project: View Reddit Comments Of Any YouTube Videos Or Web Page Web Development ...
-
5
New Reddit — You can now search comments within a Reddit post—even on desktop New Reddit gets a basic, long-requested feature at last. ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK