get_user_comments: Get comments from a specified user

Description Usage Arguments Details Value See Also Examples

Description

This returns comments made by one user. Comments can be requested for a specific timeframe or sort order.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
get_user_comments(
  user,
  accesstoken,
  sort = c("new", "hot", "controversial", "top"),
  time = c("all", "hour", "day", "week", "month", "year"),
  limit = 100,
  after = NULL,
  before = NULL,
  output = c("df", "json", "all"),
  verbose = FALSE,
  retry = FALSE
)

Arguments

user

The username of the user for which comments are requested.

accesstoken

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

sort

The order in which the submissions of the user should be ordered when accessing them. Possible values are:

  • new: Returns newest comments

  • hot: Returns highly upvoted comments currently

  • controversial: Returns comments that received a lot of upvotes and downvotes

  • top: Returns most upvoted comments in a certain timeframe. Timeframe can be specified with time.

time

The timeframe for the sort order controversial and top. Possible values are:

  • hour

  • day

  • week

  • month

  • year

  • all for comments from all time. The default value if time is not specified.

limit

The maximum number of user comments to return. Must be a number between 1 and 100.

after

The fullname of a comment serving as anchor in the request. Comments after this comment in the listing are returned.

before

The fullname of a comment serving as anchor in the request. Comments before this comment in the listing are returned.

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

Comments for the specified user as a dataframe, json object or a list containing both.

See Also

get_user

Examples

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

#Get 10 comments made by Keanu Reeves
keanu_comments <- get_user_comments(user = "_KeanuReeves",
                                    accesstoken = history_token,
                                    sort = "top", time = "all",
                                    limit = 10)

## End(Not run)

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