"Reddit" (Service Connection)
Connecting & Authenticating
Requests
Private Account Information
"AccountData" — data about the authenticated user's account
"AccountFriends" — list of authenticated user's friends
"AccountKarma" — dataset of authenticated user's karma
Private Messages
"PrivateMessages" — retrieves the mailbox from the authenticated user's account
| "Source" | "Inbox" | mailbox source | |
| MaxItems | 25 | maximum number of messages to retrieve | |
| "StartIndex" | 1 | starting position of results | |
| "ShowThumbnails" | True | import thumbnail images |
Public Account Information
"UserData" — profile information for a specified user
| "User" | authenticated user | username |
"UserTrophies" — earned trophies for a specified user
| "User" | authenticated user | username | |
| "Elements" | "FullData" | one of "FullData" or "Icon" | |
| "ShowThumbnails" | True | import thumbnail images |
"UserActivity" — get recent user activity data
| "User" | authenticated user | username | |
| "SortBy" | "New" | sorting method | |
| "Type" | "Overview" | type of user activity | |
| MaxItems | 25 | maximum number of results to retrieve | |
| "StartIndex" | 1 | starting position of results | |
| "ShowThumbnails" | False | import thumbnail images |
Detailed Information on Subreddits and Posts
"GlobalIDInformation" — get data for a "GlobalID"
| "GlobalID" | (required) | "GlobalID" list of kinds t1_, t3_, or t5_ | |
| "ShowThumbnails" | False | import thumbnail images |
"PostInformation" — get data for posts
| "Post" | (required) | URL or "GlobalID" of a post | |
| "ShowThumbnails" | False | import thumbnail images |
"SubredditInformation" — get data for a subreddit
| "Subreddit" | (required) | URL or "GlobalID" of a subreddit | |
| "ShowThumbnails" | False | import thumbnail images |
Contents of Posts and Comments
"SubredditPosts" — retrieves the posts from a subreddit
| "Subreddit" | (required) | URL or "GlobalID" of a subreddit | |
| "SortBy" | "New" | sorting method | |
| MaxItems | 25 | maximum number of posts to retrieve | |
| "StartIndex" | 1 | starting position of results | |
| "ShowThumbnails" | False | import thumbnail images |
"PostCommentsData" — retrieves the comments from a post
| "Post" | (required) | URL or "GlobalID" of a post | |
| "Depth" | 1 | depth of the comment tree | |
| MaxItems | 25 | number of posts to retrieve, to a maximum of 500; only works with depth set to 1 | |
| "StartIndex" | 1 | starting position of results | |
| "ShowThumbnails" | False | import thumbnail images |
"CommentReplyData" — retrieves the replies to a comment
| "Comment" | (required) | URL or "GlobalID" of a comment | |
| "Depth" | 1 | depth of the comment tree | |
| MaxItems | 25 | number of posts to retrieve, to a maximum of 500; only works with depth set to 1 | |
| "StartIndex" | 1 | starting position of results | |
| "ShowThumbnails" | False | import thumbnail images |
Parameter Details
| "Icon" | return a list of images | |
| "FullData" | return a dataset with all available fields | |
| "Source" | one from Inbox, Unread, or Sent | |
| "SortBy" | one from New, Top, "Hot", or "Controversial"; "Rising" is also available for "SubredditPosts" request | |
| "Type" | one from "Overview", "Submitted", "Comments", "Upvoted", "Downvoted", "Hidden", "Saved", or "Gilded" |
Examples
open all close allBasic Examples (2)
reddit = ServiceConnect["Reddit"]Get information about your Reddit account:
reddit["AccountData"]Get information about a specific post using its URL:
ServiceExecute["Reddit", "PostInformation", <|"Post" -> "https://www.reddit.com/r/thalassophobia/comments/4ke1cm/whales_surfacing/", "ShowThumbnails" -> True|>]Scope (15)
Use a "GlobalID" instead of a URL:
ServiceExecute["Reddit", "PostInformation", <|"Post" -> "t3_4ke1cm", "ShowThumbnails" -> True|>]["Thumbnail"]Get information about a specific user:
ServiceExecute["Reddit", "UserData", <|"User" -> "TheEarthquakeGuy"|>]Get information about multiple users:
ServiceExecute["Reddit", "UserData", <|"User" -> {"TheEarthquakeGuy", "thepeoplesbard"}|>]Get information on your account karma by subreddit:
ak = ServiceExecute["Reddit", "AccountKarma"]Get basic information about your trophies:
ServiceExecute["Reddit", "UserTrophies"]Get trophies from a list of users:
ServiceExecute["Reddit", "UserTrophies", <|"User" -> {"TheEarthquakeGuy", "thepeoplesbard"}, "Elements" -> "Icon"|>]//DatasetGet detailed trophy information about a specific user:
ServiceExecute["Reddit", "UserTrophies", <|"User" -> "thepeoplesbard", "Elements" -> "FullData"|>]Get information about several users' recent activity:
activity = ServiceExecute["Reddit", "UserActivity", <|"User" -> {"TheEarthquakeGuy", "Poem_for_your_sprog", "thepeoplesbard"}, "SortBy" -> "Top", "Type" -> "Comments", MaxItems -> 5|>]Retrieve data for several posts:
posts = ServiceExecute["Reddit", "PostInformation", <|"Post" -> {"https://www.reddit.com/r/thalassophobia/comments/4ke1cm/whales_surfacing/", "https://www.reddit.com/r/CozyPlaces/comments/3znzey/orient_express_sleeping_cabin/", "t3_3zlpw2"}, "ShowThumbnails" -> True|>]Get information about a specific subreddit:
ServiceExecute["Reddit", "SubredditInformation", <|"Subreddit" -> "CozyPlaces", "ShowThumbnails" -> True|>]Retrieve data on several subreddits:
subreddits = ServiceExecute["Reddit", "SubredditInformation", <|"Subreddit" -> {"Cyberpunk", "MyPeopleNeedMe", "Science"}, "ShowThumbnails" -> True|>]Get posts from different subreddits:
mposts = ServiceExecute["Reddit", "SubredditPosts", <|"Subreddit" -> {"science", "ubuntu", "mathematica"}, "ShowThumbnails" -> True|>]Dataset[«1»]mposts[[1]]["Posts"][[3]][{"Title", "Author", "CreationDate", "Thumbnail", "Ups", "Downs", "CommentsCount"}]Retrieve comments on a specific post:
AMAcomments = ServiceExecute["Reddit", "PostCommentsData", <|"Post" -> "https://www.reddit.com/r/IAmA/comments/2j4ce1/keanu_reeves_he", MaxItems -> 50|>]Create a WordCloud from the comments, removing profanity with the built-in "Profanity" classifier:
words = DeleteStopwords@Flatten[TextWords /@ Cases[Normal[AMAcomments["Comments"][All, "Body"]], _String]];
WordCloud[Tally[Pick[words, Classify["Profanity", words], False]]]Retrieve data for multiple posts:
multipleposts = ServiceExecute["Reddit", "PostCommentsData", <|"Post" -> {"https://www.reddit.com/r/FoggyPics/comments/40my3n/above_the_trees/", "https://www.reddit.com/r/thingsforants/comments/41k21u/what_is_this_a_cell_phone_for_ants/"}, "ShowThumbnails" -> True|>]replies = ServiceExecute["Reddit", "CommentReplyData", <|"Comment" -> {"https://www.reddit.com/r/askscience/comments/41sgzw/how_much_work_does_it_take_to_send_a_packet/cz4z92s"}, "Depth" -> 1, MaxItems -> 5|>]Get replies to multiple comments:
ServiceExecute["Reddit", "CommentReplyData", <|"Comment" -> {"https://www.reddit.com/r/askscience/comments/41sgzw/how_much_work_does_it_take_to_send_a_packet/cz4z92s", "https://www.reddit.com/r/netsec/comments/41r3ty/cracking_ransomware/cz4wxhm", "t1_cz4apld"}, "Depth" -> 4|>]