forked from ruangrupa/konfluks
autoformatter says change this so i change
This commit is contained in:
parent
dfa4b40d52
commit
8c4a36791f
@ -28,8 +28,7 @@ hashtags = [
|
|||||||
|
|
||||||
def login_mastodon_bot():
|
def login_mastodon_bot():
|
||||||
mastodon = Mastodon(
|
mastodon = Mastodon(
|
||||||
access_token=os.environ.get("MASTODON_AUTH_TOKEN"),
|
access_token=os.environ.get("MASTODON_AUTH_TOKEN"), api_base_url=instance
|
||||||
api_base_url = instance
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return mastodon
|
return mastodon
|
||||||
@ -73,9 +72,9 @@ def create_post(post_directory, post_metadata):
|
|||||||
|
|
||||||
template_dir = os.path.join(Path(__file__).parent.resolve(), "templates")
|
template_dir = os.path.join(Path(__file__).parent.resolve(), "templates")
|
||||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
|
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
|
||||||
name = post_metadata['account']['display_name']
|
name = post_metadata["account"]["display_name"]
|
||||||
name = sub('"', '\\"', name)
|
name = sub('"', '\\"', name)
|
||||||
post_metadata['account']['display_name'] = name
|
post_metadata["account"]["display_name"] = name
|
||||||
env.filters["localize_media_url"] = localize_media_url
|
env.filters["localize_media_url"] = localize_media_url
|
||||||
env.filters["filter_mastodon_urls"] = filter_mastodon_urls
|
env.filters["filter_mastodon_urls"] = filter_mastodon_urls
|
||||||
|
|
||||||
@ -140,7 +139,10 @@ def main():
|
|||||||
create_post(post_dir, post_metadata)
|
create_post(post_dir, post_metadata)
|
||||||
all_existing_posts.append(str(post_metadata["id"]))
|
all_existing_posts.append(str(post_metadata["id"]))
|
||||||
else:
|
else:
|
||||||
print("not pulling post %s (post is local only)" % (post_metadata["id"]))
|
print(
|
||||||
|
"not pulling post %s (post is local only)"
|
||||||
|
% (post_metadata["id"])
|
||||||
|
)
|
||||||
|
|
||||||
# if we already have the post do nothing, possibly update
|
# if we already have the post do nothing, possibly update
|
||||||
elif str(post_metadata["id"]) in existing_posts:
|
elif str(post_metadata["id"]) in existing_posts:
|
||||||
@ -149,7 +151,10 @@ def main():
|
|||||||
str(post_metadata["id"])
|
str(post_metadata["id"])
|
||||||
) # create list of posts which have not been returned in the feed
|
) # create list of posts which have not been returned in the feed
|
||||||
elif str(post_metadata["id"]) in all_existing_posts:
|
elif str(post_metadata["id"]) in all_existing_posts:
|
||||||
print("skipping post %s as it was already pulled with a different hashtag." % (str(post_metadata["id"])))
|
print(
|
||||||
|
"skipping post %s as it was already pulled with a different hashtag."
|
||||||
|
% (str(post_metadata["id"]))
|
||||||
|
)
|
||||||
|
|
||||||
for post in existing_posts:
|
for post in existing_posts:
|
||||||
print(
|
print(
|
||||||
|
Loading…
Reference in New Issue
Block a user