Description Usage Arguments Details Value Examples
This function is designed to convert query parameters supplied as arguments into a URL leading to JSON content that can be accessed via other functions. In particular, this function is designed to provide the input for import_reddit_content_from_url, which, in turn, is a function that is used to power redditr's flagship function, get_reddit_content. Using this function directly may be useful if you need to access the raw JSON for your query.
1 | construct_pushshift_url(content_type = "comment", ...)
|
content_type |
A string containing the type of content you want to query. The Pushshift API supports the following options: "comment" and "submission". This function defaults to "comment". |
... |
Additional parameters to pass to api query. See Details below. |
Here's the list of parameters that the API can use: https://github.com/pushshift/api#search-parameters-for-comments. The api ignores unrecognized parameters, so you may want to verify your output.
A string containing a URL pointing to JSON Reddit data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # url for most recent comments on Reddit
construct_pushshift_url(content_type = "comment")
# url for most recent submissions on Reddit
construct_pushshift_url(content_type = "submission")
# url for 500 most recent comments on Reddit
construct_pushshift_url(size = 500)
# url for 25 most recent posts from the rstats subreddit
construct_pushshift_url(type = "submission", subreddit = "rstats")
# url for 25 most recent posts from the rstats subreddit
construct_pushshift_url(
type = "submission",
subreddit = "rstats",
before = date_to_api("2017-03-14"),
after = date_to_api("2017-03-12")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.