Posting Time Check is a small Python script that answers "what is the best time to post in my niche" with data from your own peers. Give it your account plus 10 to 15 peer accounts and it scores their recent public posts on TikTok, Instagram and Facebook by weekday and time of day.
The problem
Generic "best time to post" charts mix every industry together. What works for a fashion brand may not work for a crypto news account. Comparing peers by hand is hard because big accounts drown out small ones.
What the app does
- Reads
handles.jsonwith your account and peers per platform. - Pulls recent public posts per account and platform.
- Scores each post against its own account's median engagement, so big and small accounts count equally.
- Groups scores by weekday and 4-hour block in the time zone you pick.
- Writes a heatmap and tables of the best and worst slots.
How it works
- Posts.
GET /desearch/tiktok/profile/{username}/posts,GET /desearch/instagram/profile/{username}/postsandGET /desearch/facebook/profile/{profile_id}/posts. - Engagement. TikTok likes + comments + shares, Instagram likes + comments, Facebook reactions + comments.
- Score = engagement / median engagement of that account. 1.0 is a normal post.
- Rank slots with 3 or more posts.
The code
def fetch(session, costs, platform, handle, count, cursor=None, page=1):
t0 = time.time()
params = {"count": count}
if cursor:
params["cursor"] = cursor
r = session.get(f"{BASE}/desearch/{platform}/profile/{handle}/posts", params=params, timeout=180)
lat = round(time.time() - t0, 2)
try:
data = r.json()
except ValueError:
data = {"non_json": r.text[:300]}
items = data if isinstance(data, list) else []
cost, uc = r.headers.get("X-Desearch-Cost-Usd"), r.headers.get("X-Desearch-Usage-Count")
costs.append({"ts": dt.datetime.now(ZoneInfo("Asia/Tbilisi")).isoformat(timespec="seconds"), "platform": platform,
"handle": handle, "count": count, "page": page, "cursor": cursor, "status": r.status_code, "latency_s": lat, "items": len(items),
"unique_items": len({p.get("id") for p in items}), "usage_count": int(uc) if uc else None,
"cost_usd": round(float(cost), 6) if cost else None})
print(f" {platform:<9} {handle:<20} p{page} {r.status_code} {lat:>5.2f}s items={len(items)} billed={uc} cost={costs[-1]['cost_usd']}", flush=True)
return itemsThe folder has posting_time_check.py, an example handles.json and the sample run in output/.
Endpoints
GET /desearch/tiktok/profile/{username}/postsGET /desearch/instagram/profile/{username}/postsGET /desearch/facebook/profile/{profile_id}/posts
Example output
The sample uses a crypto news brand as the main account and 12 public crypto news, research and exchange brand accounts as peers. That run made 49 calls and scored 316 posts. Output is a weekday by 4-hour heatmap per platform plus a table of the strongest and weakest slots.
Run it yourself
The public examples folder linked above includes the script and a README. Install its requirements, set DESEARCH_API_KEY from console.desearch.ai, and use the run command in that README.
Useful flags: --pages (more posts per account), --tz (time zone for the slots), --platforms tiktok,instagram, --max-age-days (default 90), --from-raw FILE (offline, no cost).
What it costs
Each post returned cost $0.00207. Billing is per item returned, and empty results cost nothing. The sample run was 49 calls, 316 posts and $0.654, from the X-Desearch-Cost-Usd headers. See pricing.
Ideas to extend it
The report is for teams reviewing their own account alongside peers in the same niche. Each post is scored against its own account's median engagement before the weekday groups are compared. Choose the time zone before reading the four-hour blocks, so the output matches the schedule you plan to use.
- Re-run each quarter as your audience changes.
- Add your own analytics to compare with the peer view.
- Schedule posts into the best slots.
