Back to use cases

    Use case / SOCIAL DATA / Python 3 / Published

    Reddit lead generation: find threads where people ask for a tool

    Search Reddit with GET /web and site:reddit.com for threads where people ask for a tool, a recommendation or an alternative, ranked by buying intent.

    Card for Reddit Lead Generation: Find Threads Where People Ask for a Tool

    Forum Intent Board is a small Python script for founders and marketers doing Reddit lead generation with a web search scoped to reddit.com. Give it 5 to 8 keywords from your niche and it finds public Reddit threads where people are asking for a tool, a recommendation or an alternative, then ranks them on a board.

    The problem

    People ask for product recommendations on Reddit, and those threads are some of the warmest leads there are. Finding them means searching each keyword, skipping the noise, and keeping the threads that show buying intent.

    What the app does

    • Takes a niche label and up to 8 keywords.
    • Searches Reddit for each keyword with GET /web and site:reddit.com in query.
    • Scores titles and snippets for intent phrases such as "looking for", "alternative to" and "recommend".
    • Keeps threads that are on topic and shows intent terms, so you can see why each row made the board.
    • Writes forum_hits.csv, a ranked board and a call log with cost.

    How it works

    1. Search. For each keyword, call GET /web with site:reddit.com plus the keyword in query.
    2. Clean titles. Generic Reddit titles are replaced by the thread's URL slug.
    3. Keep Reddit links. Drop results whose link is not on reddit.com.
    4. Score intent with weighted phrase rules you can edit at the top of the script.
    5. Board. Unique, on-topic threads with intent, sorted by score.

    The code

    PYTHON
        if a.from_raw:
            raw = json.load(open(a.from_raw))
        else:
            cfg = json.load(open(a.keywords)); kws = cfg["keywords"][:8]
            key = os.environ.get("DESEARCH_API_KEY") or sys.exit("set DESEARCH_API_KEY")
            start = now_local()
            days = {"PAST_24_HOURS": 1, "PAST_2_DAYS": 2, "PAST_WEEK": 7, "PAST_2_WEEKS": 14, "PAST_MONTH": 31,
                    "PAST_2_MONTHS": 62, "PAST_YEAR": 366, "PAST_2_YEARS": 731}.get(a.date_filter)
            calls = asyncio.run(run_mcp(kws, a, key))
            raw = {"run_date": start.strftime("%Y-%m-%d"), "run_started": start.isoformat(timespec="seconds"), "niche": cfg.get("niche", ""),
                   "keywords": kws, "date_filter": a.date_filter, "date_filter_days": days, "result_type": a.result_type, "calls": calls}
            if a.full_raw:
                json.dump(raw, open(a.full_raw, "w"), indent=1)
            if not a.no_link_check:
                urls = sorted({i.get("link") for c in calls for i in c["results"] if i.get("link")})
                print(f"checking {len(urls)} links ...", flush=True)

    This excerpt reads DESEARCH_API_KEY from the environment and calls run_mcp, which searches Hacker News and Reddit through the MCP ai-search tool. The folder has forum_intent_board.py, an example keywords.json, and the sample run in output/.

    Endpoints

    • GET /web

    API details

    The REST call this page describes is GET /web:

    ParameterValue
    querysite:reddit.com plus one keyword
    startoptional, 0 to 100, for the next results

    A trimmed response, with the field types from openapi.json:

    JSON
    {
      "data": [
        {
          "title": "string",
          "snippet": "string",
          "link": "string"
        }
      ]
    }

    Each request returns up to 20 results. snippet can be an empty string when the page has no text summary.

    The excerpt above is the MCP path: it calls the hosted ai-search tool once per keyword and source, with prompt, tools set to ["hackernews"] or ["reddit"], result_type: "ONLY_LINKS" and date_filter (default PAST_MONTH). On the REST route POST /desearch/ai/search, the reference lists the reddit and hackernews tools as retired: both are still accepted, each runs as a Web Search pinned to its own domain (reddit.com, news.ycombinator.com), and results arrive in search, never in a reddit_search or hacker_news_search key.

    Edge cases from the API reference for GET /web: a search with no results, or a start past the last result, returns 200 with data: [] and is not charged. An empty query returns 422.

    Background reading: How to find Reddit threads by keyword with a web search API.

    Example output

    From a run on 2026-10-12 for 8 keywords in crypto and on-chain data tools. Reddit rows come from GET /web with site:reddit.com in query.

    MeasureResult
    Calls8 (one GET /web per keyword)
    Reddit threads on the board12

    A spot check of 20 rows found 13 on topic. Keywords with a product noun ("crypto tax software") gave cleaner boards than broad ones.

    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: --board-size (default 20) and --from-raw FILE (rebuild with no API calls). Each search is GET /web with query set to site:reddit.com plus the keyword.

    What it costs

    See pricing for current rates.

    Ideas to extend it

    • Run it again and only show threads you have not seen before.
    • Draft a helpful, disclosed reply for each top thread and review it by hand.
    • Add more keywords and intent phrases to the same GET /web query.

    Use with AI agents

    Point an MCP client at the hosted Desearch server. Replace the placeholder with a key from the console. Do not commit the key.

    JSON
    {
      "mcpServers": {
        "desearch": {
          "url": "https://mcp.desearch.ai/mcp",
          "headers": {
            "Authorization": "Bearer <key>"
          }
        }
      }
    }

    Prompt you can paste for this example:

    Use Desearch GET /web with site:reddit.com to find public Reddit threads in the niche I name where people ask for a tool, a recommendation, or an alternative. Return the thread link and the ask in their words. Do not invent threads.

    Build your own example.

    Give your agents access to web and social search. Get an API key to start building, or talk to us about your integration.

    Read docs