Description Usage Arguments Details Value Examples
View source: R/reddit_functions.R
A maximum of 100 posts can be requested from a specified subreddit. The timeframe and the sorting of the posts can be specified.
1 2 3 4 5 6 7 8 9 10 11 12 |
subreddit |
The name of the subreddit from which posts are requested. |
accesstoken |
The accesstoken required to access the endpoint. Scope
must be |
sort |
The order in which the posts in the subreddit should be ordered when accessing them. Possible values are:
|
limit |
The maximum number of posts to return. Must be a number between 1 and 100. |
time |
The timeframe for the
|
after |
The fullname of a post serving as anchor in the request. Posts after this post in the listing are returned. |
before |
The fullname of a post serving as anchor in the request. Posts before this post in the listing are returned. |
output |
What the function should return. Choose |
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. |
More info at https://www.reddit.com/dev/api/
The requested posts as a dataframe, json object or a list containing both.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## 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)
# 10 "hot" posts from the subreddit askreddit
posts <- get_posts(subreddit = "askreddit",
accesstoken = read_token,
sort = "hot", limit = 10)
# The next set of posts can be retrieved with the argument "after"
posts_after <- get_posts(subreddit = "soccer",
accesstoken = read_token,
sort = "hot",
limit = 10,
after = after)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.