DEV Community

Aurelix Solutions
Aurelix Solutions

Posted on

Get public Threads posts by keyword, hashtag or profile in Python, without logging in

Threads is where a lot of brands, newsrooms and creators now post first, and where people talk about products in public. Getting those posts into a spreadsheet usually means a login, a session cookie or an app review, all for posts any logged-out browser can already see. For brand monitoring, trend research or comparing a list of accounts, the logged-out view is enough.

This post pulls Threads posts into Python from searches, hashtags, profiles and post links, compares accounts by engagement, and sets up a daily feed of new brand mentions in Slack.

Disclosure: I'm Aurelix, and I built Threads Scraper, the tool used here. It's a paid tool (prices below).

What each row holds

One row per post, 31 fields:

  • url (permalink), post_id, code, text, language, topic, links, mentions.
  • author_username, author_name, author_url, author_verified.
  • published_at (exact, ISO 8601 UTC), like_count, reply_count, repost_count, quote_count, share_count.
  • media_type, image_urls, video_urls, is_reply, reply_to_username, is_paid_partnership.
  • status, input, source_type, search_term: which search, profile or link found the post, or why a source returned nothing.

Searches and hashtags, as a sheet

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
import csv
import os

from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("aurelix/threads-scraper").call(
    run_input={
        "searchTerms": ["electric cars", "coffee", "#ai", "#travel"],
        "maxPostsPerSource": 50,
    }
)
rows = list(client.dataset(run["defaultDatasetId"]).iterate_items())
posts = [r for r in rows if r["status"] == "ok"]

fields = ["search_term", "author_username", "published_at", "like_count", "reply_count", "repost_count", "text", "url"]
with open("threads_posts.csv", "w", newline="", encoding="utf-8") as f:
    w = csv.DictWriter(f, fieldnames=fields, extrasaction="ignore")
    w.writeheader()
    w.writerows(posts)
Enter fullscreen mode Exit fullscreen mode

A term starting with # searches Threads' topic tags; anything else is a keyword search. In a test run of ten searches, each returned 13 to 25 posts (203 in all), the top posts Threads shows a logged-out visitor. A post found by two searches comes back once.

Which accounts get the most engagement

Give profiles a list of @usernames or profile links to get each one's latest posts:

from collections import defaultdict
from statistics import median

run = client.actor("aurelix/threads-scraper").call(
    run_input={"profiles": ["@nasa", "@natgeo", "@netflix", "@nike", "@spotify", "@notionhq"]}
)
by_author = defaultdict(list)
for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    if p["status"] == "ok":
        by_author[p["author_username"]].append(p)

for name, ps in sorted(by_author.items(), key=lambda kv: -median(p["like_count"] or 0 for p in kv[1])):
    likes = median(p["like_count"] or 0 for p in ps)
    replies = median(p["reply_count"] or 0 for p in ps)
    print(f"{name:10} {len(ps):>3} posts  median {likes:>7,.0f} likes  {replies:>5,.0f} replies")
Enter fullscreen mode Exit fullscreen mode

From a real run (figures move every hour):

netflix      4 posts  median   3,260 likes    102 replies
nasa         6 posts  median   2,075 likes     62 replies
natgeo       4 posts  median     296 likes      8 replies
nike         7 posts  median     202 likes      4 replies
spotify      4 posts  median     132 likes     27 replies
notionhq    10 posts  median      41 likes      1 replies
Enter fullscreen mode Exit fullscreen mode

A profile that doesn't exist or isn't public gets one not_found status row instead of posts, and isn't charged.

Track posts you already know

For campaign reporting, put post links in posts and schedule the run to record how likes, replies and reposts grow:

run_input = {"posts": ["https://www.threads.com/@zuck/post/DfaNgswkQPG"]}
Enter fullscreen mode Exit fullscreen mode

threads.net links work too.

New brand mentions every morning

run_input = {
    "searchTerms": ["notion", "#notion"],
    "incremental": True,
    "stateKey": "notion-mentions-daily",
    "slackWebhookUrl": "https://hooks.slack.com/services/...",
}
Enter fullscreen mode Exit fullscreen mode

With incremental on, the first run saves everything it finds as a baseline; each later run returns only posts no earlier run returned. In the test, the first run saved 43 posts and the next run returned 21 new ones and skipped 24 already seen; a run with nothing new returned nothing and charged only the start fee. Save the input as a task in the Apify Console and schedule it daily: the Slack URL gets the count and the top new posts with links, and nothing is sent when there is nothing new. webhookUrl posts the same digest as JSON to Zapier, Make or n8n.

Why this tool

  • No Threads account, password or cookies: it reads what a logged-out visitor sees.
  • Searches, hashtags, profiles and post links in one run, duplicates removed.
  • Exact publish times and like, reply, repost and quote counts on every row.
  • An only-new mode with a Slack or webhook digest for daily brand monitoring.
  • Cheaper than the leading tools.

Limits

  • Logged-out view only. A search returns the top posts Threads shows (usually 10 to 40), a profile its latest posts (usually 4 to 10). There is no deeper paging and no "Recent" tab without a login.
  • No replies under a post and no follower counts or bios; the reply count is on every row.
  • Share counts are shown by Threads on only some posts; elsewhere share_count is empty.
  • Media links expire after some days; download soon after the run.
  • If Threads refuses the run or asks for a login, the run stops with a BLOCKED status and charges nothing more.

Cost

$0.80 per 1,000 posts ($0.70 to $0.50 on paid Apify plans), plus a $0.0025 start fee per run. Empty searches, missing profiles, removed posts, duplicates and posts already returned in only-new mode are never charged. The current prices are on the Store page; Apify's free plan includes $5 of credit a month, about 6,200 posts.

Use it from an AI assistant

The tool also works through Apify's hosted MCP server, so Claude, ChatGPT or Cursor can run it from a request like "get the latest Threads posts from @nasa and rank them by likes". Server URL: https://mcp.apify.com/?tools=aurelix/threads-scraper.

Links

Top comments (0)