A follower count won't tell you whether a competitor's posts are reaching people, which topics get saved, or whether engagement is changing. For that, you need the posts themselves, with their views, likes, reposts, replies, quotes, bookmarks, and publication dates.
This tutorial collects those public X (Twitter) metrics with Python and Spidra, then turns the results into a small competitor-tracking dataset. You'll pull an account's profile, collect its posts, calculate a few useful measures, and save dated snapshots that you can feed into a dashboard or your own application.
We'll use developer-focused accounts such as Vercel, PostHog, and Resend, alongside a useful counterexample from @levelsio. The figures discussed below come from a collection made on November 24, 2026. They will naturally change when you run the code.
What X data can you collect?
For a profile, start with the handle, follower count, total posts, verification status, and the posts it exposes publicly. For each post, you want the post ID and URL, the text, when it was published, and its engagement counts.
The difference between post metrics and profile metrics matters. A company may have a large audience but relatively few views on individual posts. Another may have fewer followers and consistently get attention. The useful comparison is based on recent posts from the same period, not just the size of the audience.
Bookmarks are particularly worth including. X exposes the number of bookmarks on a post, but not the identities of the people who saved it. A bookmark count is another engagement signal, not evidence of what those people eventually did. X's own help page makes that distinction clear.
Scrape an X profile directly as JSON
Create a Spidra account, get an API key, and install the Python SDK:
pip install spidra
export SPIDRA_API_KEY="spd_YOUR_API_KEY"A public X profile is a URL you already know, so you can use Scrape directly. There is no need to write selectors or supply an AI extraction prompt for the standard profile fields:
# x_profile.py
import os
from spidra import Spidra
client = Spidra(api_key=os.environ["SPIDRA_API_KEY"])
profile = client.scrape("https://x.com/vercel", output="json").content
posts = profile["posts"]
order = profile.get("postsOrder")On supported X pages, the JSON includes profile information and the posts exposed for that account, with nested engagement data. Here is a shortened real response for NASA to show the shape, rather than presenting a fabricated Vercel response:
{
"type": "profile",
"handle": "NASA",
"followers": 92311944,
"postsCount": 74455,
"postsOrder": "latest",
"postCount": 39,
"posts": [
{
"id": "2114130258912043194",
"createdAt": "2026-10-24T23:01:47.000Z",
"replyCount": 0,
"repostCount": 161,
"viewCount": 39045
}
]
}The example is abbreviated. The full post objects can also include likes, quotes, bookmarks, media, links, and whether a post is a reply or repost. See the available X fields.
Notice postsOrder. Keep it. A response ordered by latest is suitable for a recent-post analysis; popular is not. We'll return to that distinction shortly.
Collect a group of profiles and their recent posts
For a competitive set, ready-made templates save you from requesting and joining each account manually. Spidra offers an X profile-stats template, a recent-posts template, and a post-metrics template for specific URLs.
Start with profile stats for the accounts you care about:
handles = ["vercel", "posthog", "resend"]
run = client.run_template("x-profile-stats", {"accounts": handles})
for row in run.rows:
print(row["handle"], row["followers"])For the November 24 snapshot, those values were:
vercel 476850
posthog 27706
resend 35592Now collect Vercel's posts:
run = client.run_template("x-recent-posts", {"accounts": ["vercel"]})
rows = run.rowsThis template returns a row per post with its text, publication date, metrics, and associated data. It reads the posts X exposes publicly. The standard run returns roughly the first 40 posts; if you need a longer window, the template also supports deeper collection. Check the input options and estimate in Spidra Templates before increasing the depth.
You can also use x-post-metrics when you already have specific post URLs to refresh. That is useful for a product tracking a small set of launches or campaigns rather than an entire account.
You don't have to use templates for this workflow. Regular Scrape returns the standard profile and post data as JSON, and Batch Scrape works when you have a list of individual post URLs. Templates are the convenient route when you want a ready-made table or more profile posts.
Turn post rows into metrics that mean something
A useful competitor report doesn't need a complicated proprietary score. Start with median views, engagement per view, replies as a share of posts, and the period your data actually covers.
Here's the core calculation. We exclude reposts from the account's own-post analysis, keep zero-view records out of engagement-rate denominators, and ignore missing values rather than treating them as zero:
from statistics import median
own = [p for p in rows if not p.get("isRepost")]
views = [p["viewCount"] for p in own if p.get("viewCount") is not None]
rates = []
for post in own:
v = post.get("viewCount")
fields = [post.get(k) for k in ("likeCount", "repostCount",
"replyCount", "quoteCount", "bookmarkCount")]
if v and all(x is not None for x in fields):
rates.append(100 * sum(fields) / v)Take the median of the views list to describe the typical reach of a post in that sample, and the median of rates to describe the typical engagement rate. This formula includes bookmarks, so don't compare it directly with a benchmark that uses only likes and comments.
The 34 recent Vercel posts in the November 24 collection had a median of 71,907 views, and 9 of the 34 were replies. A deeper collection returned 114 posts reaching back into March, with a different median of 93,412 views. Neither figure is a universal performance benchmark. They describe different windows.
One of the more useful findings was in the bookmark column. A Vercel post linking to its UI SDK GitHub repository received 6,072 bookmarks and 2,221 likes, while the “Introducing the UI SDK” announcement had 5,442 bookmarks and 6,586 likes in the same research. A tool link can attract a different kind of response from a launch announcement. You can explore that pattern across your own tracked accounts instead of deciding a content strategy from follower counts.
Check whether the posts are really recent
This is the check I'd build into every X competitor tracker.
The same collection pulled 98 posts from @levelsio with a median of about 1.74 million views. But their dates stretched from June 2018 to November 2025. They weren't a current 2026 posting window.
For some well-known accounts, X makes a selection of popular posts available instead of the newest timeline. A scraper can return those genuine posts successfully while an analytics product silently labels them “recent.”
If you use the profile Scrape response, inspect postsOrder. For a template result, check the newest and oldest timestamps in the rows. If the newest item is far outside your reporting period, don't generate a recent-performance scorecard from that set.
from datetime import datetime
dates = [datetime.fromisoformat(p["createdAt"].replace("Z", "+00:00"))
for p in own if p.get("createdAt")]
oldest, newest = min(dates), max(dates)
print(oldest.date(), newest.date())For that @levelsio sample, the date range extended from 2018-06 to 2025-11. The posts were useful for studying successful historical content, but not for comparing current posting cadence or engagement against an active company account.
A date-span check is necessary, though not sufficient. An account that publishes infrequently may also have older legitimate posts. Use the available ordering information and the actual publication dates together.
Save snapshots for your dashboard
Post metrics are counters that change over time. A row should record both the post's publication time and when you collected it. Use the post ID as the stable key within an account, and store each observation separately rather than overwriting yesterday's values.
Use an append-only CSV rather than replacing the file on every collection. The complete companion script, x_competitor_metrics_spidra.py, includes validation, deduplication, and export. The key fields are:
observed_at,handle,post_id,post_url,posted_at,text,views,likes,reposts,replies,quotes,bookmarks,is_reply,is_repostYou can append the current rows to a CSV with the publication time and observation time kept separate:
import csv
from datetime import datetime, timezone
from pathlib import Path
path = Path("x_post_snapshots.csv")
new = not path.exists() or path.stat().st_size == 0
fields = ["observed_at", "handle", "post_id", "posted_at", "views", "bookmarks"]
seen = set()
observed = datetime.now(timezone.utc).isoformat()
with path.open("a", newline="", encoding="utf-8") as file:
writer = csv.DictWriter(file, fieldnames=fields)
if new:
writer.writeheader()
for post in rows:
post_id = str(post.get("id") or "")
if not post_id or post_id in seen:
continue
seen.add(post_id)
writer.writerow({"observed_at": observed, "handle": "vercel", "post_id": post_id,
"posted_at": post.get("createdAt"),
"views": post.get("viewCount"),
"bookmarks": post.get("bookmarkCount")})Each new run adds another observation, even when the post ID is already present in the CSV from an earlier date. For a production database, key observations by account, post ID, and observation time, and decide how long to retain them. The full companion script also includes the remaining public counters and scorecard fields.
If you're collecting many URLs, Batch Scrape returns an individual result for each URL, so you can handle failed items without throwing away the rest of a run.
Track new posts without rebuilding the workflow
A dashboard that only updates when someone runs a script will eventually go stale. Spidra Monitors can rerun a saved template on a schedule and alert when new items appear or watched fields change.
For example, a monitor using x-recent-posts can watch a competitor for new public posts. That helps you decide when to update your dataset. The monitor's first check establishes its baseline; later checks compare against it.
An alert is not the same as a history database. If you want to plot six months of engagement trends, persist your own dated snapshots from the API or connect a notification to your collection process. See Monitors for scheduling and notification options.
A regular Scrape, template run, and monitor all use Spidra credits. The exact amount depends on what you request and how deeply you collect. The free plan includes 300 one-time credits, and you can check usage and plans once you've measured your own workload.
What this approach doesn't provide
X's public counters don't reveal link clicks, profile visits, audience demographics, or who bookmarked a post. Those are different from the public post metrics used here. A high bookmark count is not proof that readers installed a tool or bought anything.
Results can also vary by account. A profile may offer only popular posts, return a shallow set, or stop being publicly available. Spidra can't create missing pages or retrieve private posts, and a failed collection needs to be handled as a failed job rather than silently treated as zero engagement.
Finally, technical access is not permission to collect or reuse data. X's current Terms prohibit crawling or scraping without prior written consent, except where applicable law provides otherwise. Review the platform terms, your rights to use and retain data, and relevant privacy laws before using this workflow commercially. Our guide to web scraping and the law provides further context.
You now have the pieces of a useful X metrics pipeline: structured profile data, post-level counters, a check against misleading timelines, and dated snapshots your application can analyze. Create a free Spidra account, try the profile Scrape and x-recent-posts template on a public account you have permission to use, and build your first snapshot from the returned rows.