social-photos/social_photos/boost_mastodon.py

17 lines
613 B
Python
Raw Normal View History

2023-11-05 21:13:57 +00:00
from load_config import config
from mastodon import Mastodon
m = Mastodon(access_token=config['boost_mastodon']['token'], api_base_url=config['boost_mastodon']['server'])
def boost(url):
2023-11-05 21:51:57 +00:00
search_results = m.search(url, resolve=True, exclude_unreviewed=False)
status_result_count = len(search_results['statuses'])
if status_result_count != 1:
print("Unable to find status to boost")
return None
status_id = search_results['statuses'][0]['id']
print(f"Boosting status: {status_id}")
m.status_reblog(status_id, visibility="public")
m.status_favourite(status_id)