Compare commits

..

No commits in common. "3b4a644a13dad604acf91bae78218ec1a6d74fe1" and "fa11764b849973da1d2f0bb83a923a0e0c1069f9" have entirely different histories.

3 changed files with 10 additions and 12 deletions

View File

@ -1,14 +1,13 @@
# Changelog
**21 DEC 2022** VERSION 3.1.1
Modified code that made twoot incompatible with python versions < 3.10
**11 DEC 2022**
**11 DEC 2022** VERSION 3.1 HOTFIX
VERSION 3.1 HOTFIX
* Added missing `default.toml` file
* 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**
* 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=`.
* 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
redirection from links included in tweets. Obfuscated links are replaced
by the URL that the resource is directly downloaded from. Also improved

View File

@ -3,10 +3,9 @@
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.
**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 URL building for compatibility with Windows
Modified code that made twoot incompatible with python versions < 3.10
> Previous updates can be found in CHANGELOG.

View File

@ -30,7 +30,7 @@ import sqlite3
import sys
import time
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
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']:
import youtube_dl
video_path = f"{author_account}/status/{status_id}"
video_file = urljoin('https://twitter.com', video_path)
video_file = os.path.join('https://twitter.com', author_account, 'status', status_id)
ydl_opts = {
'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s",
'format': "best[width<=500]",
@ -982,9 +981,9 @@ def main(argv):
)
if len(media_ids) == 0:
toot = mastodon.status_post(tweet['tweet_text'])
toot = mastodon.status_post(tweet['tweet_text'], visibility='public')
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:
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')