Search code examples
csvreddit

Accessing Old reddit posts


I grabbed a set of data attributes of reddit articles into a csv using a php script, after grabbing those posts I need to monitor each article' status hourly for the next 24 hours. I have the attributes Title, ID, Name, No of comments, and Domain, but I'm currently unable to find a way to access the each/corresponding reddit post using just those attributes.

The csv which I have data

Can anybody tell me a way to access each reddit post in this csv using any of the data in its columns?


Solution

  • The id field is used in the post URL, like this: 92dd8 becomes https://www.reddit.com/comments/92dd8, which is equivalent to https://www.reddit.com/r/pics/comments/92dd8/test_post_please_ignore (except that the subreddit style is missing).

    You can also use /api/info with the name field: t3_92dd8 becomes https://www.reddit.com/api/info?id=t3_92dd8 (if you want it as JSON you can do https://www.reddit.com/api/info.json?id=t3_92dd8, which is the intended use of /api/info but it still works for HTML viewing). Note that /api/info only gives information about the link, and not comments on it, but it's still useful. (Also, /api/info can take up to 100 posts by combining them with a comma: https://www.reddit.com/api/info?id=t3_92dd8,t3_2np694 - this may be useful if you want to query a bunch of posts at once).