-
Notifications
You must be signed in to change notification settings - Fork 198
Feature request: add function for "GET friendships/show" #138
Comments
So, @fschaff, your post made me realize that when I experimented with what I thought was this API in the past, I was actually using the GET friendships/lookup API...which explains why I was so disappointed with the results. Anyway, I was able to throw something together in time for a CRAN release. So there should be at least somewhat reasonable access to friendships/show via the Required inputs are fds <- lookup_friendships(
source = "realDonaldTrump",
target = c("DRUDGE_REPORT", "seanhannity", "HuffPost", "maddow", "cnn")
)
> fds
# A tibble: 60 x 4
relationship user variable value
<chr> <chr> <chr> <chr>
1 source DRUDGE_REPORT id 25073877
2 source DRUDGE_REPORT id_str 25073877
3 source DRUDGE_REPORT screen_name realDonaldTrump
4 source DRUDGE_REPORT following TRUE
5 source DRUDGE_REPORT followed_by FALSE
6 source DRUDGE_REPORT live_following FALSE
7 source DRUDGE_REPORT can_dm FALSE
8 target realDonaldTrump id 14669951
9 target realDonaldTrump id_str 14669951
10 target realDonaldTrump screen_name DRUDGE_REPORT
# ... with 50 more rows
> It's also possible to specify more than one user in both ## vector of multiple users
usrs <- c(
"realDonaldTrump", "DRUDGE_REPORT", "seanhannity", "HuffPost", "maddow", "cnn"
)
fds <- lookup_friendships(
source = usrs,
target = usrs
)
> fds
# A tibble: 72 x 4
relationship user variable value
<chr> <chr> <chr> <chr>
1 source realDonaldTrump id 25073877
2 source realDonaldTrump id_str 25073877
3 source realDonaldTrump screen_name realDonaldTrump
4 source realDonaldTrump following FALSE
5 source realDonaldTrump followed_by FALSE
6 source realDonaldTrump live_following FALSE
7 source realDonaldTrump can_dm TRUE
8 target realDonaldTrump id 25073877
9 target realDonaldTrump id_str 25073877
10 target realDonaldTrump screen_name realDonaldTrump
# ... with 62 more rows I haven't had a lot of time to test this. If you run into problems, try setting > str(fds, 3)
List of 6
$ realDonaldTrump:List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7
$ DRUDGE_REPORT :List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7
$ seanhannity :List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7
$ HuffPost :List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7
$ maddow :List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7
$ cnn :List of 1
..$ relationship:List of 2
.. ..$ source:List of 16
.. ..$ target:List of 7 |
Thank you for your quick update on this @mkearney! The examples above work for me. Two small suggestions:
Cheers! |
@fschaff I realized the name issue shortly after I submitted the pkg to CRAN. Oopsies! As for tidying up the data...I agree. It wouldn't be a bad place to jump in if you're looking for an excuse to make a contribution! |
May I ask if you could add a function to get the information about the relationship between two users, as available trough the GET friendships/show query?
The text was updated successfully, but these errors were encountered: