
diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ + diff --git a/404.html b/404.html new file mode 100644 index 0000000..6f55493 --- /dev/null +++ b/404.html @@ -0,0 +1,114 @@ + + +
+ + + + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
+Examples of behavior that contributes to a positive environment for our community include:
+Examples of unacceptable behavior include:
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at david@schochastics.net. All complaints will be reviewed and investigated promptly and fairly.
+All community leaders are obligated to respect the privacy and security of the reporter of any incident.
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+Community Impact: A violation through a single incident or series of actions.
+Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
+Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
+Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+Consequence: A permanent ban from any sort of public interaction within the community.
+This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
+Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
+For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
+YEAR: 2022 +COPYRIGHT HOLDER: rtoots authors ++ +
Copyright (c) 2022 rtoot authors
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+When a function in rtoot
can’t find a valid token on
+your computer, it automatically starts authentication. If you want to
+start the process manually, you can do so by calling:
+library(rtoot)
+auth_setup()
By default, the token is stored in a directory R has determined to
+make sense for you and it is called “rtoot_token.rds”. So you do not
+need to worry about it if you are only using rtoot
on your
+local machine and you are only using one token.
If you do not change the path
argument of
+auth_setup()
the tokens get stored in the location returned
+by tools::R_user_dir("rtoot", "config")
. Look there, if you
+want to copy a token to a different computer (ideally in the directory
+returned by tools::R_user_dir("rtoot", "config")
on the new
+machine).
If you want to use multiple tokens, you should change the name of the +file the token is saved in:
+
+auth_setup(name = "account1")
To use this token, you can either read it into your environment and +provide it to each function:
+
+token <- readRDS(file.path(tools::R_user_dir("rtoot", "config"), "account1.rds"))
+get_status(id = "109297677620300632", instance = "mastodon.social", token = token)
Or you can set the default token in the options at the start of a +session:
+
+options("rtoot_token" = file.path(tools::R_user_dir("rtoot", "config"), "account1.rds"))
For advanced users, you can also store your token as an environment +variable (envvar). You can either obtain a token by calling
+
+auth_setup(clipboard = TRUE)
Or, if you already have a token
+
+token <- readRDS(file.path(tools::R_user_dir("rtoot", "config"), "account1.rds"))
+content <- convert_token_to_envvar(token)
Paste the content from clipboard to your configuration file. If you
+don’t have access to clipboard, inspect content
.
This vignette provides a quick tour of the package.
+ +First you should set up your own credentials (see also the vignette +on authentication)
+
+auth_setup()
The mastodon API allows different access levels. Setting up a token +with your own account grants you the most access.
+In contrast to twitter, mastodon is not a single instance, but a
+federation of different servers. You sign up at a specific server (say
+“mastodon.social”) but can still communicate with others from other
+servers (say “fosstodon.org”). The existence of different instances
+makes API calls more complex. For example, some calls can only be made
+within your own instance (e.g get_timeline_home()
), others
+can access all instances but you need to specify the instance as a
+parameter (e.g. get_timeline_public()
).
A list of active instances can be obtained with
+get_fedi_instances()
. The results are sorted by number of
+users.
General information about an instance can be obtained with
+get_instance_general()
+get_instance_general(instance = "mastodon.social")
get_instance_activity()
shows the activity for the last
+three months and get_instance_trends()
the trending
+hashtags of the week.
+get_instance_activity(instance = "mastodon.social")
+get_instance_trends(instance = "mastodon.social")
To get the most recent toots of a specific instance use
+get_timeline_public()
+get_timeline_public(instance = "mastodon.social")
To get the most recent toots containing a specific hashtag use
+get_timeline_hashtag()
+get_timeline_hashtag(hashtag = "rstats", instance = "mastodon.social")
The function get_timeline_home()
allows you to get the
+most recent toots from your own timeline.
rtoot
exposes several account level endpoints. Most
+require the account id instead of the username as an input. There is, to
+our knowledge, no straightforward way of obtaining the account id. With
+the package you can get the id via search_accounts()
.
+search_accounts("schochastics")
(Future versions will allow to use the username and user id +interchangeably)
+Using the id, you can get the followers and following users with
+get_account_followers()
and
+get_account_following()
and statuses with
+get_account_statuses()
.
+id <- "109302436954721982"
+get_account_followers(id)
+get_account_following(id)
+get_account_statuses(id)
You can post toots with:
+
+post_toot(status = "my first rtoot #rstats")
It can also include media and alt_text.
+
+post_toot(status = "my first rtoot #rstats", media="path/to/media",
+ alt_text = "description of media")
You can mark the toot as sensitive by setting
+sensitive = TRUE
and add a spoiler text with
+spoiler_text
.
Be aware that excessive automated posting is frowned upon (or +even against the ToS) in many instances. Make sure to check the ToS of +your instance and be mindful when using this function.
+All relevant functions in the package support pagination of results
+if the limit
parameter is larger than the default page size
+(which is 40 in most cases). In this case, you may get more results than
+requested since the pages are always fetched as a whole. If you for
+example request 70 records, you will get 80 back, given that many
+records exist.
The package allows to access three different streams of Mastodon
+data. Public timelines via stream_timeline_public()
,
+timelines from a given hashtag via
+stream_timeline_hashtag()
and timelines from lists via
+stream_timeline_list()
.
By default, all functions stream statuses for 30 seconds. This can be
+adjusted via the parameter timeout
. If set to
+Inf
, data is streamed indefinitely. The parameter
+file_name
is used to specify to which file the data should
+be written. If non is provided, a temporary file is created. However, we
+recommend to always set this parameter explicitely.
For stream_timeline_public()
and
+stream_timeline_hashtag()
, you can also decide if you want
+to stream globally, or from a specific instance. If you want to stream
+from a specific instance, set local=TRUE
and set
+instance
to the desired instance. If instance is NULL, then
+the function uses the instance you obtained a token from (see vignette
+on authentication).
Once parameters are specified, you can start the desired stream. +Streaming will occupy your current instance of R until the specified +time has elapsed or any error occurs. Streaming itself shouldn’t be very +memory intensive so you can start a new R instance in parallel.
+
+#stream a minute of all statuses
+stream_timeline_public(timeout = 60, file_name = "public.json")
+
+#stream a minute of all statuses using the rstats hashtag
+stream_timeline_public(hashtag = "rstats", timeout = 60, file_name = "public.json")
If verbose=TRUE
, the functions will indicate when
+streaming is supposed to stop and the number of statuses that have been
+written to file.
Note that in contrast to rtweet
, the streaming functions
+never directly return any data. This can be done afterwards using
+parse_stream()
which reads in the json and converts it to a
+data frame. Note that this process can take a while depending on the
+number of statuses in the file.