fix: don't pull the same post twice but for real
This commit is contained in:
parent
36b4ca1ba4
commit
7e45112280
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user