Code Monkey home page Code Monkey logo

mastodon's Introduction

Mastodon

Installation in R

Use the devtools R package to install from Github:

devtools::install_github('ThomasChln/mastodon')

Docker

A docker image with the package installed is also available

docker run -it thomaschln/mastodon

Usage

Login and posts

library(mastodon)
token = login('https://framapiaf.org/', '[email protected]', 'password')
post_status(token, 'Status text')
post_media(token, 'Image caption', file = '/home/user/file.png')
post_ggplot(token, 'Mastodon instances and users', ggplot_instances_info())

Timelines and hashtags

df = get_timeline(token, 'home')
df = get_timeline(token, 'local')
df = get_timeline(token, 'fediverse')
df = get_hashtag(token, 'rstats')

# Get more toots (default rate limit: 2 second sleep for each 20 toots)
df = get_timeline(token, 'fediverse', n = 30)
df = get_hashtag(token, 'mastodon', n = 30)

# Get toots before a specific id
df = get_timeline(token, 'fediverse', max_id = 26432)
df = get_hashtag(token, 'mastodon', max_id = 26432)

# Get hashtag only on local instance
df = get_hashtag(token, 'rstats', local = TRUE)

Searches

Search for a string or a username

df = search(token, 'thchln')

# don't resolve non-local accounts
df = search(token, 'thchln', local = TRUE)

df = search_username(token, 'thchln')
df = search_username(token, 'thchln', limit = 2)

Get an account or a toot by id

account = get_account(token, 475)
toot = get_status(token, 26432)

Fediverse info and plots

Number of users per instances

ggplot_instances_info()

Participation by hours

# Use a large server
token = login('https://mastodon.xyz/', '[email protected]', 'password')
df_toots = get_timeline(token, 'fed', n = 7e4)
toots_by_hours(df_toots) %>% ggplot_toots_by_hours(token$instance)

Participation of top 6 instances

toots_by_instances(df_toots) %>% ggplot_toots_by_instances(token$instance)

Acknowledgements

License

This package is free and open source software, licensed under GPL-3.

mastodon's People

Contributors

aarles avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.