Movatterモバイル変換


[0]ホーム

URL:


Networks

Get Followers and Follows

You can retrieve a list of followers and those followed by a userthrough theget_followers andget_followsfunctions, respectively. This gives a glimpse of their social dynamicson the platform.

Load the package

library(atrrr)

get_followers

Retrieve the followers of a specific account withget_followers:

get_followers(actor ="benguinaudeau.bsky.social",limit =200)|>  dplyr::glimpse()#> Rows: 200#> Columns: 8#> $ did               <chr> "did:plc:nol67uyam6hzj5…#> $ indexed_at        <dttm> 2024-02-29 13:50:12, 2…#> $ actor_handle      <chr> "dkarpa.bsky.social", "…#> $ actor_name        <chr> "David Karpa", "Rémi Pa…#> $ actor_description <chr> "PhD-candidate UBremen.…#> $ actor_avatar      <chr> "https://cdn.bsky.app/i…#> $ viewer_data       <list> [FALSE, FALSE], [FALSE…#> $ labels_data       <list> [], [], [], [], [], []…

get_follows

Retrieve the accounts that are followed by a specific account withget_follows:

get_follows(actor ="benguinaudeau.bsky.social",limit =200)|>  dplyr::glimpse()#> Rows: 174#> Columns: 8#> $ did               <chr> "did:plc:3ryku2cbgpazor…#> $ indexed_at        <dttm> 2024-02-08 05:16:04, 2…#> $ actor_handle      <chr> "beamagistro.bsky.socia…#> $ actor_name        <chr> "Beatrice Magistro", "S…#> $ actor_description <chr> "PostDoc @Caltech, thru…#> $ actor_avatar      <chr> "https://cdn.bsky.app/i…#> $ viewer_data       <list> [FALSE, FALSE], [FALSE…#> $ labels_data       <list> [], [], [], [], [], []…

You’ll notice each follower/following has a description (i.e. theirbio). It’s a nifty way to get to know a bit about them at a glance!

Follower Network Visualization

This section guides you through the process of visualizing a followernetwork for a given user on Blue Sky. The primary focus is on theinterconnected relationships among followers.

The first step is to load some additional packages. Then we get thefollowers for the main user we are interested in. We will then delvedeeper and fetch the followers for each of these followers.

library(ggplot2)library(dplyr)library(purrr)library(tidyr)library(igraph)library(ggraph)library(tidygraph)# Retrieve the followers for the main usersome_followers<-get_followers(actor ="benguinaudeau.bsky.social",limit =10)$actor_handle# For each follower, retrieve their own set of followers.# This provides a nested view of relationships.followers_of_followers<- some_followers|>  purrr::map_dfr(~{get_followers(actor = .x,limit =200)|>mutate(from = .x)  })|>  dplyr::rename(to = actor_handle)|>  dplyr::select(from, to)%>%  dplyr::add_count(to,name ="n_to")%>%  dplyr::add_count(from,name ="n_from")%>%  dplyr::filter(n_to>1| n_from>1)%>%  dplyr::select(-n_to:-n_from)

Building and Visualizing the Follower Network

# Construct the network graph and plotgraph<- tidygraph::as_tbl_graph(followers_of_followers,directed =TRUE)# Use ggraph to visualize the network.ggraph::ggraph(graph,layout ='fr')+  ggraph::geom_edge_link()+  ggraph::geom_node_point(aes(size = tidygraph::centrality_pagerank()),color ="lightblue")+  ggraph::geom_node_text(aes(label = name,size = tidygraph::centrality_pagerank(),family ="mono",fontface ="bold"),vjust =1,hjust =1,check_overlap = T,color ="white",show.legend = F)+  ggraph::geom_node_text(aes(label = name,size = tidygraph::centrality_pagerank(),family ="mono"),vjust =1,hjust =1,check_overlap = T,color ="blue",show.legend = F)+  ggplot2::theme_void()+  ggplot2::theme(legend.position ="bottom")
Follower Network

Follower Network

Find people to follow

You can use a similar approach to find new people you might want tofollow. First get all the people you already follow by quering your ownaccount:

my_follows<-get_follows(actor ="jbgruber.bsky.social",limit =10)$actor_handle# limit only for demonstration# For each account you follow, retrieve who they follow.follows_of_follows<- my_follows|>  purrr::map_dfr(~{get_followers(actor = .x,limit =100)|>mutate(from = .x)  })# Now we can check which accounts are popular among the people you already followfollows_of_follows|>  dplyr::filter(!actor_handle%in% my_follows)|># exclude accounts you already follow  dplyr::count(actor_name, actor_handle,sort =TRUE)#> # A tibble: 704 × 3#>    actor_name                actor_handle         n#>    <chr>                     <chr>            <int>#>  1 Johannes B. Gruber        jbgruber.bsky.s…     9#>  2 Center for Ballot Freedom fusionvoting.bs…     4#>  3 David Karpa               dkarpa.bsky.soc…     3#>  4 Jacob Ware                jacobware.bsky.…     3#>  5 Jens Rydgren              jensrydgren.bsk…     3#>  6 edminkardes               gorkem.me            3#>  7 Adrian Florea             aflorea.bsky.so…     2#>  8 Brian O'Meara             omearabrian.bsk…     2#>  9 Darren Dahly              statsepi.bsky.s…     2#> 10 Erik Angner               erikangner.com       2#> # ℹ 694 more rows

The original account shows up in this overview, as do accounts thatwere excluded because of the limit set to do the demonstration.

But all of these accounts look interesting!

Likes and Reposts

You can also retrieve the accounts that liked or reposted yourskeets.

Who liked your skeets?

Want to create like networks? Theget_likes functionallows you to extract information about users who liked a specific post.By simply providing the post’s URL, you can get a list of users whoexpressed their appreciation for the content.

get_likes("https://bsky.app/profile/ryanlcooper.com/post/3kb42gayda52t")|>  dplyr::glimpse()#> Rows: 25#> Columns: 5#> $ created_at   <dttm> 2023-10-06 21:22:39, 2023-1…#> $ indexed_at   <dttm> 2023-10-06 21:22:39, 2023-1…#> $ actor_handle <chr> "csehested.bsky.social", "da…#> $ actor_name   <chr> NA, "TassieDevyl", "Hans LeJ…#> $ actor_data   <list> ["did:plc:zzsj7hy3wec6fhbwu…

Who reposted your skeets?

Want to create repost networks? Reposts (or reskeets), akin toretweets on platforms like Twitter, amplify the reach of content bysharing it with a wider audience.

Theget_reposts function is designed to retrieveinformation about users who reposted a specific piece of content.

get_reposts(post_url ="https://bsky.app/profile/ryanlcooper.com/post/3kb42gayda52t")|>  dplyr::glimpse()#> Rows: 25#> Columns: 8#> $ did               <chr> "did:plc:zyvmwfzbkt3igd…#> $ indexed_at        <dttm> 2024-01-26 00:03:39, 2…#> $ actor_handle      <chr> "zunguzungu.bsky.social…#> $ actor_name        <chr> "Aaron Bady", "Bertie R…#> $ actor_description <chr> "Meat blood, bees, thin…#> $ actor_avatar      <chr> "https://cdn.bsky.app/i…#> $ viewer_data       <list> [FALSE, FALSE], [FALSE…#> $ labels_data       <list> [], [], [], [], [], []…

[8]ページ先頭

©2009-2025 Movatter.jp