X's API bills every returned post, so one developer moved filters into the search query

Tim, a self-taught developer in Nairobi who builds small data tools as Apify Actors, built a tool to find trending posts on X. He noted that X's robots.txt disallows most bots, so the tool uses the official X API v2 with each user's own Bearer Token. X's pay-per-use pricing charges per returned post, so filtering in code would still incur costs for discarded posts. Instead, he used operators such as min_likes, min_reposts and min_replies within the search query so below-threshold posts are never returned or billed. He also excluded reposts and added author expansions as an optional, default-on setting, since user lookups cost more.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in