Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit628de70

Browse files
committed
resolves#39
1 parente4c025e commit628de70

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

‎NEWS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* adds functions for direct messages
44
* adds function to query starter packs from a user
55
* simplifies make_request and make it compatible with future httr2 versions
6+
* get_user_info now uses app_bsky_actor_get_profile to query individual profiles (see#39)
67

78
#atrrr 0.1.0
89

‎R/actors.r‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ search_user <- function(query,
7676
}
7777

7878

79-
#' Query profile of an actor
79+
#' Query profile of an actor or actors
80+
#'
81+
#' @details
82+
#' Note that if you query several actors at once, profiles that do not (longer)
83+
#' exist will be missing from the results. If you query and individual actors
84+
#' and the profile is missing, the API will return an error and a message like
85+
#' "Account has been suspended".
86+
#'
8087
#'
8188
#' @param actor user handle(s) to get information for.
8289
#' @inheritParams search_user
@@ -93,12 +100,17 @@ get_user_info <- function(actor,
93100
parse=TRUE,
94101
.token=NULL) {
95102

103+
fun<-app_bsky_actor_get_profile2
104+
if (length(actor)>1) {
105+
fun<-app_bsky_actor_get_profiles
106+
}
107+
96108
actor_l<- split(actor, ceiling(seq_along(actor)/25L))
97109

98110
res<-list()
99111
for (actor_iinactor_l) {
100112
res<- append(res, do.call(
101-
what=app_bsky_actor_get_profiles,
113+
what=fun,
102114
args=list(
103115
actor_i,
104116
.token=.token,
@@ -112,3 +124,16 @@ get_user_info <- function(actor,
112124
}
113125
return(res)
114126
}
127+
128+
129+
# app_bsky_actor_get_profile returns different format, making it harder to parse
130+
app_bsky_actor_get_profile2<-function(actor,.token=NULL,.return= c("json","resp")) {
131+
list(profiles=list(make_request(
132+
name="bsky.social/xrpc/app.bsky.actor.getProfile",
133+
params= as.list(match.call())[-1]|>
134+
purrr::imap(~ {
135+
eval(.x,envir= parent.frame())
136+
}),
137+
req_method="GET"
138+
)))
139+
}

‎man/get_user_info.Rd‎

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp