fix: don't pull the same post twice but for real

This commit is contained in:
knoflook 2022-01-28 15:49:40 +01:00
parent 36b4ca1ba4
commit 7e45112280
Signed by untrusted user: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C

View File

@ -124,15 +124,13 @@ def main():
for post_metadata in timeline: for post_metadata in timeline:
post_dir = os.path.join(hashtag_dir, str(post_metadata["id"])) 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 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 str(post_metadata["id"]) not in all_existing_posts:
if not post_metadata[ if not post_metadata[
"local_only" "local_only"
]: # if you get an error here then you are using vanilla Mastodon, this is a Hometown or Glitch only feature ]: # 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) create_post(post_dir, post_metadata)
all_existing_posts.append(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"]))
@ -142,6 +140,8 @@ def main():
existing_posts.remove( existing_posts.remove(
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:
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(