在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):robertoszek/pleroma-bot开源软件地址(OpenSource Url):https://github.com/robertoszek/pleroma-bot开源编程语言(OpenSource Language):Python 98.3%开源软件介绍(OpenSource Introduction):Stork (pleroma-bot)Mirror your favorite Twitter accounts in the Fediverse, so you can follow their updates from the comfort of your favorite instance. Or migrate your own to the Fediverse using a Twitter archive. You can find this project at:
Supports:
IntroductionAfter using the pretty cool mastodon-bot for a while, I found it was lacking some actions which were of use to me. For precisely those cases I've written this Python project that automates them, asking such info to Twitter's API and updating the relevant fields on the Pleroma API/Mastodon API/Misskey API side. FeaturesSo basically, it does the following:
InstallationUsing pip
Using a package managerHere's a list of the available packages.
Usage$ pleroma-bot [-c CONFIG] [-l LOG] [--noProfile] [--daemon] [--forceDate [FORCEDATE]] [-a ARCHIVE] Bot for mirroring one or multiple Twitter accounts in Pleroma/Mastodon.
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
path of config file (config.yml) to use and parse. If
not specified, it will try to find it in the current
working directory.
-d, --daemon run in daemon mode. By default it will re-run every
60min. You can control this with --pollrate
-p POLLRATE, --pollrate POLLRATE
only applies to daemon mode. How often to run the
program in the background (in minutes). By default is
60min.
-l LOG, --log LOG path of log file (error.log) to create. If not
specified, it will try to store it at your config file
path
-n, --noProfile skips Fediverse profile update (no background image,
profile image, bio text, etc.)
--forceDate [FORCEDATE]
forces the tweet retrieval to start from a specific
date. The twitter_username value (FORCEDATE) can be
supplied to only force it for that particular user in
the config
-s, --skipChecks skips first run checks
-a ARCHIVE, --archive ARCHIVE
path of the Twitter archive file (zip) to use for
posting tweets.
--verbose, -v
--version show program's version number and exit Before runningYou'll need the following:
If you plan on retrieving tweets from an account which has their tweets protected, you'll also need the following:
You'll also need Elevated access in your Twitter's API project in order for the bot to function properly. Refer to the docs for more info about this. ConfigurationCreate a There's a config example in this repo called For more information you can refer to the "Configuration" page on the docs. Here's what a minimal config looks like: # Change this to your target Fediverse instance
pleroma_base_url: https://pleroma.instance
# How many tweets to get in every execution
# Twitter's API hard limit is 3,200
max_tweets: 40
# Twitter bearer token
twitter_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
users:
- twitter_username: User1
pleroma_username: MyPleromaUser1
# Mastodon/Pleroma bearer token
pleroma_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX RunningIf you're running the bot for the first time it will ask you for the date you wish to start retrieving tweets from (it will gather all from that date up to the present).
If you leave it empty and just press enter it will default to the oldest date that Twitter's API allows (' To force this behaviour in future runs you can use the Additionally, you can provide a For example: $ pleroma-bot --forceDate WoolieWoolz If the --noProfile argument is passed, the profile picture, banner, display name and bio will not be updated on the Fediverse account. However, it will still gather and post the tweets following your config's parameters. NOTE: An crontab entry example(everyday at 6:15 AM) update profile and (every 10 min.) post new tweets: # Post tweets every 10 min
*/10 * * * * cd /home/robertoszek/myvenv/ && . bin/activate && pleroma-bot noProfile
# Update pleroma profile with Twitter info every day at 6:15 AM
15 6 * * * cd /home/robertoszek/myvenv/ && . bin/activate && pleroma-bot ScreenshotsAcknowledgementsThese projects proved to be immensely useful, they are Python wrappers for the Mastodon API and Twitter API respectively: They were part of the impetus for this project, challenging myself to not just import them and use them, instead opting to directly do the heavy lifting with built-in python modules. That and mastodon-bot not working after upgrading the Pleroma instance I was admin on |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论