get_subreddit_info: Get basic information for a specified subreddit.

Description Usage Arguments Details Value Examples

Description

Get basic information for a specified subreddit.

Usage

1
2
3
4
5
6
7
8
get_subreddit_info(
  subreddit,
  type = c("info", "moderators", "rules"),
  accesstoken,
  output = c("df", "json", "all"),
  verbose = FALSE,
  retry = FALSE
)

Arguments

subreddit

Name of the subreddit for which info is requested.

type

Which info is requested. Possible values are info for information about the subreddit from the sidebar, moderators for the moderators of the subreddit and rules for the rules of the subreddit.

accesstoken

The accesstoken required to access the endpoint. Scope must be "read".

output

What the function should return. Choose json for an unparsed json object, df for a parsed object in form of a dataframe, and all for a list containg the json object, a dataframe, and the before and after anchors (if those exist for the endpoint).

verbose

A logical flag whether information about the data extraction should be printed to the console.

retry

A logical flag whether a failed api request should be retried. Requests will be tried up to three times with varying time intervals between requests.

Details

More info at https://www.reddit.com/dev/api/

Value

Basic information about a subreddit from the sidebar or the moderators or the rules of the subreddit as a dataframe, json object or a list containing both.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
read_token <- get_token(scope = "read",
                        useragent = my_useragent,
                        username = my_username,
                        password = my_password,
                        client_id = my_client_id,
                        client_secret = my_client_secret)

#Get sidebar for subreddit "soccer"
sub_info <- get_subreddit_info(subreddit = "soccer",
                               type = "info",
                               accesstoken = read_token)

#Get moderators for subreddit "soccer"
moderators <- get_subreddit_info(subreddit = "soccer",
                                type = "moderators",
                                accesstoken = read_token)

## End(Not run)

jfeldhege/redditoR documentation built on April 2, 2020, 9:42 p.m.