mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-04-14 00:37:35 +00:00
Improved formatting
This commit is contained in:
parent
725b7b5dc9
commit
54c59fa676
18
twoot.py
18
twoot.py
@ -25,7 +25,6 @@ import os
|
||||
import shutil
|
||||
import random
|
||||
import re
|
||||
import shutil
|
||||
import sqlite3
|
||||
import sys
|
||||
import time
|
||||
@ -294,9 +293,9 @@ def substitute_source(orig_url):
|
||||
parsed_url.fragment
|
||||
])
|
||||
|
||||
|
||||
return dest_url
|
||||
|
||||
|
||||
def clean_url(orig_url):
|
||||
"""
|
||||
Given a URL, return it with the UTM parameters removed from query and fragment
|
||||
@ -535,8 +534,7 @@ def login(password):
|
||||
try:
|
||||
mastodon = Mastodon(
|
||||
access_token=TOML['config']['mastodon_user'] + '.secret',
|
||||
api_base_url='https://' + TOML['config']['mastodon_instance']
|
||||
)
|
||||
api_base_url='https://' + TOML['config']['mastodon_instance'])
|
||||
except MastodonError as me:
|
||||
logging.fatal('Login to ' + TOML['config']['mastodon_instance'] + ' Failed\n')
|
||||
logging.fatal(me)
|
||||
@ -757,12 +755,6 @@ def main(argv):
|
||||
# Make soup
|
||||
soup = BeautifulSoup(twit_account_page.text, 'html.parser')
|
||||
|
||||
# Replace twitter_account with version with correct capitalization
|
||||
# ta = soup.find('meta', property='og:title').get('content')
|
||||
# ta_match = re.search(r'\(@(.+)\)', ta)
|
||||
# if ta_match is not None:
|
||||
# TOML['config']['twitter_account'] = ta_match.group(1)
|
||||
|
||||
# Extract twitter timeline
|
||||
timeline = soup.find_all('div', class_='timeline-item')
|
||||
|
||||
@ -861,8 +853,7 @@ def main(argv):
|
||||
if attachments_class is not None:
|
||||
pics, vid_in_tweet = process_attachments(nitter_url,
|
||||
attachments_class,
|
||||
status_id, author_account
|
||||
)
|
||||
status_id, author_account)
|
||||
photos.extend(pics)
|
||||
if vid_in_tweet:
|
||||
tweet_text += '\n\n[Video embedded in original tweet]'
|
||||
@ -872,7 +863,7 @@ def main(argv):
|
||||
tweet_text += '\n\n' + TOML['options']['footer']
|
||||
|
||||
# Add footer with link to original tweet
|
||||
if TOML['options']['remove_original_tweet_ref'] == False:
|
||||
if TOML['options']['remove_original_tweet_ref'] is False:
|
||||
if TOML['options']['footer'] != '':
|
||||
tweet_text += '\nOriginal tweet : ' + substitute_source(full_status_url)
|
||||
else:
|
||||
@ -1054,5 +1045,6 @@ def main(argv):
|
||||
|
||||
terminate(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user