Skip to content

Commit

Permalink
Merge pull request #13 from JBGruber/0.0.2.9000
Browse files Browse the repository at this point in the history
bump version to 0.0.2.9000
  • Loading branch information
JBGruber authored Jan 11, 2024
2 parents 8a9b11f + fd5e212 commit e055ab4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions R/convert.r
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ convert_at_to_http <- function(link) {

if (is.na(r) | is.na(k)) return(NA_character_)

handle <- try(do.call(get_user_info, list(actor = r)), silent = TRUE) |>
purrr::pluck("actor_handle", .default = r)
handle <- did_lookup(r) |>
sub("^at://", "", x = _)

glue::glue("https://bsky.app/profile/{handle}/post/{k}")

Expand Down
11 changes: 11 additions & 0 deletions R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ com_atproto_repo_upload_blob2 <- function(image,
}


did_lookup <- function(did) {
# cheers hrbrmstr!
httr2::request("https://plc.directory/") |>
httr2::req_url_path_append(did) |>
httr2::req_error(is_error = function(resp) FALSE) |>
httr2::req_perform() |>
httr2::resp_body_json(check_type = FALSE) |>
purrr::pluck("alsoKnownAs", 1, .default = did)
}


#' matches the behavior of Python's re.find with multi-byte characters
#' @noRd
str_locate_all_bytes <- function(string, pattern) {
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test-actors.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("search actors", {
expect_gte(nrow(search_user("JBGruber")), 1L)
})

test_that("search actors", {
test_that("use info", {
expect_type(get_user_info("benguinaudeau.bsky.social", parse = FALSE), "list")
expect_s3_class(get_user_info("jbgruber.bsky.social"), "tbl_df")
expect_gte(nrow(get_user_info("favstats.bsky.social")), 1L)
Expand Down

0 comments on commit e055ab4

Please sign in to comment.