diff --git a/boost_mastodon.py b/boost_mastodon.py index 695e86e..a797f75 100644 --- a/boost_mastodon.py +++ b/boost_mastodon.py @@ -5,7 +5,13 @@ from mastodon import Mastodon m = Mastodon(access_token=config['boost_mastodon']['token'], api_base_url=config['boost_mastodon']['server']) def boost(url): - url = "pixelfed.scot/i/web/post/626860160148125215" - search_results = m.search(url, resolve=True) - print(search_results) - print("Error with searching") \ No newline at end of file + url = "https://pixelfed.scot/i/web/post/626007326735984162" + 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) diff --git a/publish_pixelfed.py b/publish_pixelfed.py index b00081e..4c640c3 100644 --- a/publish_pixelfed.py +++ b/publish_pixelfed.py @@ -9,14 +9,14 @@ def upload(file_data: list): print("Uploading image to Pixelfed") media_upload = m.media_post(file['path'], "image/jpeg") print("Posting to Pixelfed") - post_upload = m.status_post(formatPost(file), media_ids = media_upload['id']) + post_upload = m.status_post(formatPost(file), media_ids = media_upload['id'], visibility="public") return post_upload['url'] def formatPost(file: dict): tag_string = formatTags(file['tags']) if load_config.config['pixelfed']['add_to_description']: file['description'] = file['description'] + load_config.config['pixelfed']['add_to_description'] - return f"{file['title']} | {file['description']}\n{tag_string}" # Date needs adding + return f"{file['title']} | {file['description']}

{tag_string}" # Date needs adding def formatTags(tags: list): formatted_tags = ['#' + tag.title().replace(' ', '') for tag in tags]