Skip to content

Commit

Permalink
Fix post check
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua committed Aug 2, 2024
1 parent dca7c7e commit 3e0cc29
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/instawebhooks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,13 @@ async def check_for_new_posts():

new_posts_found = False

for post in posts:
for post in takewhile(
lambda p: p.date > until, dropwhile(lambda p: p.date > since, posts)
):
new_posts_found = True
logger.debug("New post found: https://www.instagram.com/p/%s", post.shortcode)
await send_to_discord(post)
sleep(20) # Avoid 30 requests per minute rate limit
sleep(2) # Avoid 30 requests per minute rate limit

if not new_posts_found:
logger.debug("No new posts found.")
Expand Down

0 comments on commit 3e0cc29

Please sign in to comment.