get_submissions: Get submissions for a specified user

Description Usage Arguments Details Value See Also Examples

Description

Submissions are posts made by one user. Submissions can be requested for a specific timeframe or sort order.

Usage

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

Arguments

user

The username of the user for which submissions 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: Sorts posts by the time when they were created

  • hot: Sorts posts by posts currently trending

  • controversial: Sorts posts by number of upvotes and downvotes

  • top: Most upvoted posts 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 posts from all time. The default value if time is not specified.

limit

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

before

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

after

The fullname of a post serving as anchor in the request. Posts after this post 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

Posts for a 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
## Not run: 
history_token <- get_token(scope = "history",
                           useragent = useragent,
                           username = username,
                           password = password,
                           client_id = client_id,
                           client_secret = client_secret)

submissions <- get_submissions(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.