Merge pull request 'fix: don't pull the same post twice but for real' (#22) from knoflook/lumbunglib:master into master

Reviewed-on: ruangrupa/lumbunglib#22
This commit is contained in:
knoflook 2022-01-28 15:50:46 +01:00
commit 22d9a62c20
1 changed files with 3 additions and 3 deletions

View File

@ -124,15 +124,13 @@ def main():
for post_metadata in timeline:
post_dir = os.path.join(hashtag_dir, str(post_metadata["id"]))
# if there is a post in the feed we dont already have locally, make it
if str(post_metadata["id"]) not in all_existing_posts:
if not post_metadata[
"local_only"
]: # if you get an error here then you are using vanilla Mastodon, this is a Hometown or Glitch only feature
create_post(post_dir, post_metadata)
all_existing_posts.append(post_metadata["id"])
all_existing_posts.append(str(post_metadata["id"]))
else:
print("not pulling post %s (post is local only)" % (post_metadata["id"]))
@ -142,6 +140,8 @@ def main():
existing_posts.remove(
str(post_metadata["id"])
) # create list of posts which have not been returned in the feed
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"])))
for post in existing_posts:
print(