Skip to contents

Search Posts

Usage

search_post(q, limit = 100L, parse = TRUE, verbose = NULL, .token = NULL)

search_skeet(q, limit = 100L, parse = TRUE, verbose = NULL, .token = NULL)

Arguments

q

search query. See Details.

limit

Maximum number of records to return. For queries with more than 100 results, pagination is used automatically (one request per 100 results). The function stops when the limit is reached, but you will usually get a few items more than requested.

parse

Parse the results or return the original nested object sent by the server.

verbose

Whether to print status messages to the Console (TRUE/FALSE). Package default (when NULL) is to have status messages. Can be changed with Sys.setenv(ATR_VERBOSE = FALSE).

.token

If you manage your own tokens, you can supply it here. Usually NULL is OK and will automatically load or guide you to generate a token.

Value

a data frame (or nested list) of posts

Details

The API docs claim that Lucene query syntax is supported (Boolean operators and brackets for complex queries). But only a small subset is actually implemented:

  • Whitespace is treated as implicit AND, so all words in a query must occur, but the word order and proximity are ignored.

  • Double quotes indicate exact phrases.

  • from:<handle> will filter to results from that account.

  • - excludes terms (does not seem to be working at the moment).

Note that matches can occur anywhere in the skeet, not just the text. For example, a term can be in the link preview, or alt text of an image.

Examples

if (FALSE) { # \dontrun{
search_post("rstats")
# finds post with the hashtag rstats AND the word Bluesky somewhere in the
# skeet (ignoring capitalisaion)
search_post("#rstats Bluesky")

# search for the exact phrase "new #rstats package"
search_post("\"new #rstats package\"")
# Use single quotes so you do not need to escape double quotes
search_post('"new #rstats package"')

# only search for skeets from one user
search_post("from:jbgruber.bsky.social #rstats")
} # }