mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-23 16:38:42 +00:00
Compare commits
7 Commits
341ba582c2
...
bfe3aa050e
Author | SHA1 | Date | |
---|---|---|---|
|
bfe3aa050e | ||
|
ecdc814dc7 | ||
|
275f7c9a3f | ||
|
a11a6cba65 | ||
|
faedf27a37 | ||
|
38e505ad6e | ||
|
36248dbce1 |
@ -1,11 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**01 FEB 2023** VERSION 3.1.3
|
||||||
|
|
||||||
|
* Fixed *remove link redirections* option that would not work in some cases
|
||||||
|
* Added `utm_brand` to list of blacklisted query parameters removed by *remove trackers from URLs* option
|
||||||
|
|
||||||
**04 JAN 2023** VERSION 3.1.2
|
**04 JAN 2023** VERSION 3.1.2
|
||||||
|
|
||||||
* *Posting Privacy* setting of the Mastodon account now defines visibility of toots posted with Twoot
|
* *Posting Privacy* setting of the Mastodon account now defines visibility of toots posted with Twoot
|
||||||
* Modified URL building for compatibility with Windows
|
* Modified URL building for compatibility with Windows
|
||||||
|
|
||||||
**21 DEC 2022** VERSION 3.1.1
|
**21 DEC 2022** VERSION 3.1.1
|
||||||
|
|
||||||
Modified code that made twoot incompatible with python versions < 3.10
|
Modified code that made twoot incompatible with python versions < 3.10
|
||||||
|
|
||||||
**11 DEC 2022** VERSION 3.1 HOTFIX
|
**11 DEC 2022** VERSION 3.1 HOTFIX
|
||||||
@ -27,7 +33,6 @@ Modified code that made twoot incompatible with python versions < 3.10
|
|||||||
* Config file option `log_days =` specifies how long to keep log messages in file. Older messages are deleted.
|
* Config file option `log_days =` specifies how long to keep log messages in file. Older messages are deleted.
|
||||||
|
|
||||||
**23 NOV 2022** VERSION 2.5 Added command-line option (`-l`) to remove
|
**23 NOV 2022** VERSION 2.5 Added command-line option (`-l`) to remove
|
||||||
redirection from links included in tweets. Obfuscated links are replaced
|
|
||||||
by the URL that the resource is directly downloaded from. Also improved
|
by the URL that the resource is directly downloaded from. Also improved
|
||||||
tracker removal by cleaning URL fragments as well (contrib: mathdatech,
|
tracker removal by cleaning URL fragments as well (contrib: mathdatech,
|
||||||
thanks!).
|
thanks!).
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
Twoot is a python script that mirrors tweets from a twitter account to a Mastodon account.
|
Twoot is a python script that mirrors tweets from a twitter account to a Mastodon account.
|
||||||
It is simple to set-up on a local machine, configurable and feature-rich.
|
It is simple to set-up on a local machine, configurable and feature-rich.
|
||||||
|
|
||||||
**UPDATE 01 FEB 2023** VERSION 3.1.3
|
**15/02/2023** VERSION 3.2 Added mitigation for Mastodon API error 422, 'Unprocessable Entity',
|
||||||
|
'Cannot attach files that have not finished processing. Try again in a moment!' reported
|
||||||
* Fixed *remove link redirections* option that would not work in some cases
|
on some instances when posting toots with video.
|
||||||
* Added `utm_brand` to list of blacklisted query parameters removed by *remove trackers from URLs* option
|
|
||||||
|
|
||||||
> Previous updates can be found in CHANGELOG.
|
> Previous updates can be found in CHANGELOG.
|
||||||
|
|
||||||
|
18
twoot.py
18
twoot.py
@ -981,16 +981,24 @@ def main(argv):
|
|||||||
# Post toot
|
# Post toot
|
||||||
toot = {}
|
toot = {}
|
||||||
try:
|
try:
|
||||||
mastodon = Mastodon(
|
|
||||||
access_token=TOML['config']['mastodon_user'] + '.secret',
|
|
||||||
api_base_url='https://' + TOML['config']['mastodon_instance']
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(media_ids) == 0:
|
if len(media_ids) == 0:
|
||||||
toot = mastodon.status_post(tweet['tweet_text'])
|
toot = mastodon.status_post(tweet['tweet_text'])
|
||||||
else:
|
else:
|
||||||
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
||||||
|
|
||||||
|
except MastodonAPIError:
|
||||||
|
# Assuming this is an:
|
||||||
|
# ERROR ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Cannot attach files that have not finished processing. Try again in a moment!')
|
||||||
|
logging.warning('Mastodon API Error 422: Cannot attach files that have not finished processing. Waiting 15 seconds and retrying.')
|
||||||
|
# Wait 15 seconds
|
||||||
|
time.sleep(15)
|
||||||
|
# retry posting
|
||||||
|
try:
|
||||||
|
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
||||||
|
except MastodonError as me:
|
||||||
|
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||||
|
logging.error(me)
|
||||||
|
|
||||||
except MastodonError as me:
|
except MastodonError as me:
|
||||||
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||||
logging.error(me)
|
logging.error(me)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user