Description Usage Arguments Details Value Examples
View source: R/reddit_functions.R
Searches can be confined to one subreddit or conducted in all of reddit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
query |
The search query. Maximum length of the query is 512 characters. |
accesstoken |
The accesstoken required to access the endpoint. Scope
must be |
subreddit |
The name of the subreddit in which the search should be conducted. If it is NULL, the search will be conducted in all subreddits. |
sort |
The order in which the search results should be ordered when accessing them. Possible values are:
|
limit |
The maximum number of search results to return. Must be a number between 1 and 100. |
time |
The timeframe in which the search results were created. Possible values are:
|
type |
The type of item to return. Must be |
after |
The fullname of a search result serving as anchor in the request. Search results after this post in the listing are returned. |
before |
The fullname of a search result serving as anchor in the request. Search results 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. |
A '+' has to be put between multiple search terms in the query. Information on how to build advanced search queries can be found at this link: https://www.reddit.com/wiki/search
Posts matching the search query 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 22 23 24 | ## 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)
#Search for posts in a single subreddit
search_results_movies <- search_reddit(subreddit = "movies",
accesstoken = read_token,
query = "Keanu+Reeves",
sort = "relevance",
limit = 10,
time = "year")
# Search for posts in all of reddit
search_results_reddit <- search_reddit(subreddit = NULL,
accesstoken = read_token,
query = "Keanu+Reeves",
sort = "relevance",
limit = 10)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.