mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-23 16:38:42 +00:00
Compare commits
No commits in common. "3b4a644a13dad604acf91bae78218ec1a6d74fe1" and "fa11764b849973da1d2f0bb83a923a0e0c1069f9" have entirely different histories.
3b4a644a13
...
fa11764b84
@ -1,14 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
**21 DEC 2022** VERSION 3.1.1
|
**11 DEC 2022**
|
||||||
Modified code that made twoot incompatible with python versions < 3.10
|
|
||||||
|
|
||||||
**11 DEC 2022** VERSION 3.1 HOTFIX
|
VERSION 3.1 HOTFIX
|
||||||
|
|
||||||
* Added missing `default.toml` file
|
* Added missing `default.toml` file
|
||||||
* Corrected a bug that could cause an infinity loop when log file is empty
|
* Corrected a bug that could cause an infinity loop when log file is empty
|
||||||
|
|
||||||
**11 DEC 2022** VERSION 3.0 brings some important changes and new features:
|
VERSION 3.0 brings some important changes and new features:
|
||||||
|
|
||||||
* Only potentially breaking change: **If you are using a version of python < 3.11 you need to install the `tomli` module**
|
* Only potentially breaking change: **If you are using a version of python < 3.11 you need to install the `tomli` module**
|
||||||
* Twoot can be configured with a config file in [TOML](https://toml.io/) format. Check `default.toml` for details
|
* Twoot can be configured with a config file in [TOML](https://toml.io/) format. Check `default.toml` for details
|
||||||
@ -21,6 +20,7 @@ Modified code that made twoot incompatible with python versions < 3.10
|
|||||||
* The verbosity of logging messages can be set in the config file with `log_level=`.
|
* The verbosity of logging messages can be set in the config file with `log_level=`.
|
||||||
* 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
|
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
|
||||||
|
@ -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 04 JAN 2023** VERSION 3.1.2
|
**UPDATE 21 DEC 2022** VERSION 3.1.1
|
||||||
|
|
||||||
* *Posting Privacy* setting of the Mastodon account now defines visibility of toots posted with Twoot
|
Modified code that made twoot incompatible with python versions < 3.10
|
||||||
* Modified URL building for compatibility with Windows
|
|
||||||
|
|
||||||
> Previous updates can be found in CHANGELOG.
|
> Previous updates can be found in CHANGELOG.
|
||||||
|
|
||||||
|
9
twoot.py
9
twoot.py
@ -30,7 +30,7 @@ import sqlite3
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse, urljoin
|
from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup, element
|
from bs4 import BeautifulSoup, element
|
||||||
@ -424,8 +424,7 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
|
|||||||
if TOML['options']['upload_videos']:
|
if TOML['options']['upload_videos']:
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
|
|
||||||
video_path = f"{author_account}/status/{status_id}"
|
video_file = os.path.join('https://twitter.com', author_account, 'status', status_id)
|
||||||
video_file = urljoin('https://twitter.com', video_path)
|
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s",
|
'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s",
|
||||||
'format': "best[width<=500]",
|
'format': "best[width<=500]",
|
||||||
@ -982,9 +981,9 @@ def main(argv):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if len(media_ids) == 0:
|
if len(media_ids) == 0:
|
||||||
toot = mastodon.status_post(tweet['tweet_text'])
|
toot = mastodon.status_post(tweet['tweet_text'], visibility='public')
|
||||||
else:
|
else:
|
||||||
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids, visibility='public')
|
||||||
|
|
||||||
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')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user