import json
import requests
import time

latest_timestamp = time.time() + 86500
# more than a day ago, so the loop goes the first time :)
posts_count = 0

while(latest_timestamp > (time.time() - 86400)):
    latest_posts_request = requests.get("https://blockpost.network/api/v1/posts/latest?from=" + str(latest_timestamp))
    latest_posts_json = json.loads(latest_posts_request.text)
    latest_posts = latest_posts_json["data"]
    latest_timestamp = latest_posts[-1]["timestamp"]
    for post in latest_posts:
        if post["timestamp"] > (time.time() - 86400):
            posts_count += 1

print(posts_count)
