gesistsa / rtoot

:mammoth: R package to interact with the mastodon API
https://gesistsa.github.io/rtoot/
Other
104 stars 14 forks source link

inconsistency between get_instance_rules and get_instance_general #132

Closed marcohhu closed 1 year ago

marcohhu commented 1 year ago

Hello,

there seems to be inconsistency between the above functions. Let us try get_instance_rules to get the rules of a particular instance:

library(rtoot)
get_instance_rules("pixey.org")
#> Error: something went wrong. Status code: 404

status code 404 occurs.

While using get_instance_general() works fine. And you get the instance rule from the output

get_instance_general("pixey.org")$rules
#> [[1]]
#> [[1]]$id
#> [1] "1"
#> 
#> [[1]]$text
#> [1] "Sexually explicit or violent media must be marked as sensitive when posting."
#> 
#> 
#> [[2]]
#> [[2]]$id
#> [1] "2"
#> 
#> [[2]]$text
#> [1] "No racism, sexism, homophobia, transphobia, xenophobia, or casteism."
#> 
#> 
#> [[3]]
#> [[3]]$id
#> [1] "3"
#> 
#> [[3]]$text
#> [1] "No incitement of violence or promotion of violent ideologies."
#> 
#> 
#> [[4]]
#> [[4]]$id
#> [1] "4"
#> 
#> [[4]]$text
#> [1] "No illegal content.

Everythink works well for other instances, e.g. mastodon.social

library(rtoot)
get_instance_rules("mastodon.social")
#> # A tibble: 5 × 2
#>   id    text                                                                    
#>   <chr> <chr>                                                                   
#> 1 1     Sexually explicit or violent media must be marked as sensitive when pos…
#> 2 2     No racism, sexism, homophobia, transphobia, xenophobia, or casteism     
#> 3 3     No incitement of violence or promotion of violent ideologies            
#> 4 4     No harassment, dogpiling or doxxing of other users                      
#> 5 7     Do not share intentionally false or misleading information
get_instance_general("mastodon.social")$rules
#> [[1]]
#> [[1]]$id
#> [1] "1"
#> 
#> [[1]]$text
#> [1] "Sexually explicit or violent media must be marked as sensitive when posting"
#> 
#> 
#> [[2]]
#> [[2]]$id
#> [1] "2"
#> 
#> [[2]]$text
#> [1] "No racism, sexism, homophobia, transphobia, xenophobia, or casteism"
#> 
#> 
#> [[3]]
#> [[3]]$id
#> [1] "3"
#> 
#> [[3]]$text
#> [1] "No incitement of violence or promotion of violent ideologies"
#> 
#> 
#> [[4]]
#> [[4]]$id
#> [1] "4"
#> 
#> [[4]]$text
#> [1] "No harassment, dogpiling or doxxing of other users"
#> 
#> 
#> [[5]]
#> [[5]]$id
#> [1] "7"
#> 
#> [[5]]$text
#> [1] "Do not share intentionally false or misleading information"
packageVersion("rtoot")
#> [1] '0.3.0'
R.version
#>                _                                
#> platform       x86_64-w64-mingw32               
#> arch           x86_64                           
#> os             mingw32                          
#> crt            ucrt                             
#> system         x86_64, mingw32                  
#> status                                          
#> major          4                                
#> minor          3.0                              
#> year           2023                             
#> month          04                               
#> day            21                               
#> svn rev        84292                            
#> language       R                                
#> version.string R version 4.3.0 (2023-04-21 ucrt)
#> nickname       Already Tomorrow

I have not been able to see a pattern yet, but the problem is not limited to a single instance. However, I noticed the problem rather by chance.

schochastics commented 1 year ago

interesting catch. Weirdly enough, this works, which is essentially the same call

rtoot::rtoot("/api/v1/instance/rules",params = list(instance="pixey.org"))

I will dig into that

schochastics commented 1 year ago

get_instance_rules now calls get_instance_general to get the rules. Seemed to be the most straightforward fix since I could not find the issue with the rules endpoint. Closing this now but @marcohhu feel free to reopen if the issue persists