Browse Source

remove hardcoded config-part and typo

master
hfte 2 years ago
parent
commit
75a4ff11db
  1. 1
      README.md
  2. 6
      mastaface.py

1
README.md

@ -22,4 +22,3 @@ Please be sure to get the permission **before** mirroring some facebook site.
## Usage:
Copy ```config.json.example``` to ```config.json``` and adjust it to your needs.
Setup a cronjob to run the script periodically. Timelap must be shorter than minimum time difference between two facebook posts.

6
mastaface.py

@ -47,7 +47,7 @@ else:
'mastodon_statuses': None }
# Get facebook page
posts = get_posts('seedkollektiv', pages=1)
posts = get_posts(config['facebook_page'], pages=1)
# Extract last post
posts_list = list(posts)
@ -69,7 +69,7 @@ if post['post_id'] == database[config['facebook_page']]['last_post_id']:
else:
statuses = None
statuses = []
print('Upload image if it exists')
# Upload image if it exists
if post['image']:
url = post['image']
subprocess.run(['curl', url, '--output', 'tmp.jpg',
@ -86,14 +86,12 @@ else:
else:
toot = toot_text
if is_main_toot:
print('A')
if post['image']:
statuses.append(mastodon.status_post(toot, media_ids=media))
else:
statuses.append(mastodon.status_post(toot))
is_main_toot = False
else:
print('C')
statuses.append(mastodon.status_post(toot), in_reply_to_id = statuses[-1])
# Update database of bridging history

Loading…
Cancel
Save