cd /news/ai-tools/how-i-detect-b2b-buying-intent-in-pu… · home › topics › ai-tools › article
[ARTICLE · art-173845] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

How I detect B2B buying intent in public developer forums with Python + an LLM

A developer described a Python pipeline for detecting B2B buying intent in public developer and founder forums, fetching recent posts from Hacker News, Dev.to and Stack Exchange Software Recommendations, deduplicating them with SHA-256 hashes, pre-filtering with cheap keyword rules, then scoring each post 1–10 with an LLM that returns strict JSON and keeping only scores of 7 or higher. The production collector runs every six hours with a 36-hour lookback across Reddit, Hacker News, Lobsters, Dev.to and Stack Exchange, using the Arctic Shift archive as the primary Reddit path and official Reddit as fallback to avoid 403 and 429 errors.

recommendation

Deduplicate posts by platform plus external ID and pre-filter with cheap keyword rules before calling the LLM, keeping only scores of 7 or higher to cut token spend.

more in playbook: Controlling LLM cost
by read17 min views9 publishedNov 21, 2026

Keyword alerts are a bad way to find software buyers.

Search Reddit or Hacker News for "alternative to" and you will get launch posts, affiliate roundups, venting, and the occasional genuine "I need to replace this before renewal." The last one is the only row I want. Everything else is noise that burns time and, if you score it with a model, tokens.

This article walks through the pipeline I use to detect B2B buying intent in public developer and founder forums: fetch recent posts, deduplicate them, pre-filter with cheap text rules, then ask an LLM for a strict JSON score. I run the production collector in TypeScript; the approach is easier to read in Python, which is what I will use here.

At the end I will point to a hosted API that already does this, if you would rather not operate a collector yourself. The useful part is the method. You can stop after the script and still have something that works.

I am not trying to detect curiosity or brand mentions. I want posts where the author is trying to buy, switch, or replace software: a SaaS tool, an AI product, automation, a developer tool, or a marketing/growth tool.

A practical scoring scale, used as an integer from 1 to 10:

Two rules matter more than the rest of the prompt:

I also ask the model for a category, an urgency (low, medium, or high), the software names explicitly cited, and one sentence that describes the buyer's need. The sentence is what you will actually use later, in Slack or in a CRM note.

public posts
    → SHA-256 hash of platform + external id (dedup)
    → keyword pre-filter, plus a looser software + question pass
    → LLM JSON analysis (capped per run and per day)
    → keep only if intent_score >= 7

In production this runs every six hours, looking back 36 hours, against Reddit, Hacker News, Lobsters, Dev.to, and Stack Exchange Software Recommendations. The Python script below uses the three sources that are easiest to call from a laptop: the HN Algolia API, the Dev.to API (help and discuss), and the Stack Exchange API for Software Recommendations. The same pre-filter and scorer apply if you add Reddit later.

A note on Reddit, because it is the noisiest source and the one people reach for first: official JSON and RSS endpoints often return 403 or 429 from cloud IPs. A production collector needs a polite User-Agent, delays between requests, and a fallback. I use a near-real-time public archive (Arctic Shift) as the primary Reddit path and official Reddit as a fallback, and I skip any subreddit that errors so one 403 does not kill the run.

Stick to public APIs, send a real User-Agent, and sleep between pages. Software Recommendations is a special case: almost every question is "please recommend software," so I treat those posts as buying-intent candidates even when they do not match my keyword list. They still go through the LLM. The pre-filter is skipped; the score threshold is not.

Hacker News is searched with quoted intent phrases ("alternative to", "looking to replace", "willing to pay", and so on) across Ask HN, stories, and comments. Comments are noisy, so I drop any comment that does not also look like a software/tool discussion. Dev.to is simpler: page recent articles tagged help or discuss and keep those inside the time window.

import time
import requests

USER_AGENT = "BuyingIntentTutorial/1.0 (dev.to article)"
HEADERS = {"User-Agent": USER_AGENT, "Accept": "application/json"}
HN_ALGOLIA = "https://hn.algolia.com/api/v1/search_by_date"

INTENT_SEARCH_PHRASES = (
    '"looking for"',
    '"alternative to"',
    '"recommend a"',
    '"any suggestions"',
    '"switching from"',
    '"willing to pay"',
    '"need a tool"',
    '"replacement for"',
    '"looking to replace"',
    '"frustrated with"',
)

def get_json(url, params=None, timeout=15):
    res = requests.get(url, headers=HEADERS, params=params, timeout=timeout)
    res.raise_for_status()
    return res.json()

def fetch_hn(since_unix, until_unix, max_pages=2):
    posts, seen = [], set()
    for phrase in INTENT_SEARCH_PHRASES:
        for tags in ("ask_hn", "story", "comment"):
            for page in range(max_pages):
                data = get_json(
                    HN_ALGOLIA,
                    {
                        "query": phrase,
                        "tags": tags,
                        "numericFilters": f"created_at_i>={since_unix},created_at_i<{until_unix}",
                        "hitsPerPage": 50,
                        "page": page,
                    },
                )
                hits = data.get("hits") or []
                for hit in hits:
                    object_id = hit.get("objectID")
                    if not object_id or object_id in seen:
                        continue
                    title = (hit.get("title") or hit.get("story_title") or "HN comment").strip()
                    body = hit.get("comment_text") or hit.get("story_text") or ""
                    if tags == "comment" and not SOFTWARE_QUALIFIER.search(f"{title}\n{body}"):
                        continue
                    seen.add(object_id)
                    posts.append(
                        {
                            "platform": "hackernews",
                            "external_id": str(object_id),
                            "source": "hackernews",
                            "url": f"https://news.ycombinator.com/item?id={object_id}",
                            "title": title,
                            "body": strip_html(body),
                            "author": hit.get("author"),
                        }
                    )
                if not hits or page + 1 >= data.get("nbPages", 1):
                    break
                time.sleep(0.15)
    return posts

SOFTWARE_QUALIFIER and strip_html are in the complete script at the end. Dev.to and Software Recommendations follow the same shape: normalize each item into platform, external_id, url, title, body, and author.

Hash platform and the source's own id, not the title. Titles get edited; ids do not.

import hashlib

def source_hash(post):
    key = f"{post['platform']}:{post['external_id']}"
    return hashlib.sha256(key.encode()).hexdigest()

In production I store two things: accepted signals, and a memory of every post already analysed (including rejects). Without the second table, a post that scored 4 yesterday will be sent to the model again tomorrow. That is wasted spend, and it also hides your true yield (accepted / analysed), which you need if you ever tune keywords.

For a local script, a JSON file of hashes is enough.

If you send every Ask HN and every #discuss post to an LLM, most of your bill will be spent confirming that a post is not about buying software. A case-insensitive substring check against a short phrase list removes the bulk of that.

Phrases that have been useful in practice:

alternative to, looking to replace, replacement for, switching from, migrate from looking for, recommend a, any suggestions, any recommendations, can anyone recommend, seeking recommendations, tool recommendations need a tool, need software, need a saas, software for, best tool, what tool do you, how do you automate willing to pay, ready to pay, budget for, in the market for, frustrated with Two exceptions keep this from being too tight:

saas, tool, crm, automation, vendor, and similar) ?, alternative, recommend, replace, Then rank: more keyword hits first, then longer bodies. Short titles with no context are a poor use of the cap.

def match_keywords(text, keywords):
    haystack = " ".join(text.lower().split())
    return [k for k in keywords if k.lower() in haystack]

def is_loose_buying_candidate(title, body):
    text = f"{title}\n{body}"
    if not SOFTWARE_QUALIFIER.search(text):
        return False
    return any(cue.search(text) for cue in BUYING_QUESTION_CUES)

def to_candidates(posts, keywords):
    keyword_hits, loose_hits = [], []
    for post in posts:
        if post["platform"] == "stackexchange" and post["source"] == "softwarerecs":
            keyword_hits.append({**post, "matched_keywords": ["softwarerecs"]})
            continue
        matched = match_keywords(f"{post['title']}\n{post['body']}", keywords)
        if matched:
            keyword_hits.append({**post, "matched_keywords": matched})
        elif is_loose_buying_candidate(post["title"], post["body"]):
            loose_hits.append({**post, "matched_keywords": ["loose_intent"]})

    def rank(post):
        return (-len(post["matched_keywords"]), -len(post["body"]))

    keyword_hits.sort(key=rank)
    loose_hits.sort(key=rank)
    return keyword_hits + loose_hits

Only then do you slice the queue to a budget (MAX_AI_CALLS per run, plus a daily cap if you put this on a cron).

Use an OpenAI-compatible chat API at a low temperature (0.1). The exact provider does not matter. The contract does: one JSON object, no markdown, no commentary, with a fixed set of keys.

Categories I use:

ai_tools, saas_alternative, automation, dev_tools, marketing_growth

The user message is boring on purpose: platform, title, and a body truncated to 2,000 characters. Long threads do not need to be fully scored; the question is usually in the first few paragraphs.

CATEGORIES = {
    "ai_tools",
    "saas_alternative",
    "automation",
    "dev_tools",
    "marketing_growth",
}
URGENCIES = {"low", "medium", "high"}

SYSTEM_PROMPT = """
You are a B2B sales-intelligence analyst. You read a public post from Reddit,
Hacker News, Lobsters, Dev.to or Stack Exchange (Software Recommendations)
and decide whether its author shows REAL buying intent for software (SaaS, AI
tools, automation, developer tools, marketing/growth tools): actively searching
for a tool, asking for alternatives, frustrated with a current vendor, ready
to switch or pay.

Scoring guide for intent_score (integer 1-10):
1-3 = no purchase intent (news, opinion, self-promotion, launch announcement,
      hiring, rant without need)
4-6 = vague interest or early research
7-8 = clear need, actively evaluating solutions
9-10 = urgent, explicit intent to buy/switch now (budget, deadline,
       "need it this week")
Posts where the author promotes their OWN product must score <= 3.

Respond with ONLY one JSON object, no markdown, no commentary, exactly these keys:
{
  "intent_score": <integer 1-10>,
  "category": "ai_tools" | "saas_alternative" | "automation" | "dev_tools" | "marketing_growth",
  "problem_summary": "<one actionable sentence in English describing the buyer's need>",
  "mentioned_tools": ["<software/product names explicitly cited>"],
  "urgency": "low" | "medium" | "high"
}
""".strip()

def build_user_prompt(post, max_chars=2000):
    body = post["body"]
    if len(body) > max_chars:
        body = body[:max_chars] + "…"
    source = f" ({post['source']})" if post.get("source") else ""
    return f"Platform: {post['platform']}{source}\nTitle: {post['title']}\nBody: {body or '(empty)'}"

Models will still wrap the object in `` ``` json fences, emit smart quotes, leave a trailing comma, or add a <think> block. Parse defensively, then validate:

intent_score must be numeric; round it and clamp it to 1–10category must be one of the five values above, or the whole analysis is invalidproblem_summary must be a string of at least a few characters (I cap it at 500)urgency must be low, medium, or high; if it is missing or malformed I default it to mentioned_tools is a de-duplicated list of short strings (I cap each name at 60 characters and the list at 15) If validation fails, retry a few times with backoff. If it still fails, skip the post and move on. Do not insert a half-parsed row.

``python`

def validate_analysis(raw):

if not isinstance(raw, dict):

    return None

try:

    score = int(round(float(raw.get("intent_score"))))

except (TypeError, ValueError):

    return None

score = min(10, max(1, score))
category = str(raw.get("category") or "").strip().lower().replace("-", "_").replace(" ", "_")
if category not in CATEGORIES:
    return None

summary = " ".join(str(raw.get("problem_summary") or "").split()).strip()
if len(summary) < 5:
    return None

urgency = str(raw.get("urgency") or "").strip().lower()
if urgency not in URGENCIES:
    urgency = "low"

tools, seen = [], set()
for item in raw.get("mentioned_tools") or []:
    if not isinstance(item, str):
        continue
    name = item.strip()[:60]
    key = name.lower()
    if not name or key in seen:
        continue
    seen.add(key)
    tools.append(name)
    if len(tools) >= 15:
        break

return {
    "intent_score": score,
    "category": category,
    "problem_summary": summary[:500],
    "mentioned_tools": tools,
    "urgency": urgency,
}

`

Only persist a signal when intent_score >= 7. Still record the hash of rejects, so you never pay to score them again.

This is a public Reddit thread, with the kind of structured result the scorer should return. The username is omitted on purpose.

saas_alternative ["Veeqo", "Vesyl"] That is a keep: a named current tool, a specific constraint, and an active search for a replacement. A "what's the best AI tool?" post with no constraint would land in the 4–6 band and be dropped.

Save the complete file as detect_intent.py, then:

``bash`

pip install requests openai

export OPENAI_API_KEY=sk-...

export OPENAI_MODEL=gpt-4o-mini # or whatever your provider expects

python detect_intent.py

`

The script fetches about 36 hours of HN / Dev.to / Software Recommendations posts, pre-filters, scores at most 15 candidates, and prints anything that meets the threshold. It writes analysed hashes to processed_hashes.json.

``python`

"""Detect B2B buying intent in public HN, Dev.to and Software Recs posts."""

from future import annotations

import hashlib

import json

import os

import re

import time

from datetime import datetime, timezone

from pathlib import Path

import requests

from openai import OpenAI

LOOKBACK_HOURS = 36

MAX_AI_CALLS = 15

MIN_INTENT_THRESHOLD = 7

BODY_MAX_CHARS = 2000

USER_AGENT = "BuyingIntentTutorial/1.0 (dev.to article)"

HEADERS = {"User-Agent": USER_AGENT, "Accept": "application/json"}

HASH_FILE = Path("processed_hashes.json")

KEYWORDS = [

"alternative to",

"looking for",

"recommend a",

"any suggestions",

"any recommendations",

"suggestions for",

"switching from",

"migrate from",

"budget for",

"willing to pay",

"ready to pay",

"need a tool",

"need software",

"need a saas",

"looking to replace",

"replacement for",

"frustrated with",

"can anyone recommend",

"seeking recommendations",

"in the market for",

"software for",

"best tool",

"how do you automate",

"what tool do you",

"tool recommendations",

]

INTENT_SEARCH_PHRASES = (

'"looking for"',

'"alternative to"',

'"recommend a"',

'"any suggestions"',

'"any recommendations"',

'"switching from"',

'"willing to pay"',

'"ready to pay"',

'"need a tool"',

'"need software"',

'"replacement for"',

'"looking to replace"',

'"can anyone recommend"',

'"in the market for"',

'"frustrated with"',

)

CATEGORIES = {

"ai_tools",

"saas_alternative",

"automation",

"dev_tools",

"marketing_growth",

}

URGENCIES = {"low", "medium", "high"}

SOFTWARE_QUALIFIER = re.compile(

r"\b(saas|software|tool|tools|app|apps|platform|crm|api|"

r"automat(?:e|ion|ing)?|subscription|vendor|workspace|plugin|"

r"integration|dashboard|productiv(?:e|ity)|analytics|billing|"

r"invoice|payroll|onboard(?:ing)?)\b",

re.I,

)

BUYING_QUESTION_CUES = [

re.compile(r"\?"),

re.compile(r"\bwhat (?:do you|would you|should i|can i)\b", re.I),

re.compile(r"\bhow do (?:you|i|we)\b", re.I),

re.compile(r"\b(?:anyone|any one) (?:here )?(?:use|using|know|tried|recommend)", re.I),

re.compile(r"\binstead of\b", re.I),

re.compile(r"\brecommend(?:ation)?s?\b", re.I),

re.compile(r"\balternative\b", re.I),

re.compile(r"\bwhat(?:'s| is) the best\b", re.I),

re.compile(r"\blooking to\b", re.I),

re.compile(r"\bneed (?:help finding|something|an? (?:tool|app|software|saas|platform))", re.I),

re.compile(r"\bswitch(?:ing)? (?:from|to)\b", re.I),

re.compile(r"\breplace\b", re.I),

]

SYSTEM_PROMPT = """

You are a B2B sales-intelligence analyst. You read a public post from Reddit,

Hacker News, Lobsters, Dev.to or Stack Exchange (Software Recommendations)

and decide whether its author shows REAL buying intent for software (SaaS, AI

tools, automation, developer tools, marketing/growth tools): actively searching

for a tool, asking for alternatives, frustrated with a current vendor, ready

to switch or pay.

Scoring guide for intent_score (integer 1-10):

1-3 = no purchase intent (news, opinion, self-promotion, launch announcement,

  hiring, rant without need)

4-6 = vague interest or early research

7-8 = clear need, actively evaluating solutions

9-10 = urgent, explicit intent to buy/switch now (budget, deadline,

   "need it this week")

Posts where the author promotes their OWN product must score <= 3.

Respond with ONLY one JSON object, no markdown, no commentary, exactly these keys:

{

"intent_score": ,

"category": "ai_tools" | "saas_alternative" | "automation" | "dev_tools" | "marketing_growth",

"problem_summary": "",

"mentioned_tools": [""],

"urgency": "low" | "medium" | "high"

}

""".strip()

def strip_html(text: str) -> str:

text = re.sub(r"<[^>]+>", " ", text or "")

return re.sub(r"\s+", " ", text).strip()

def get_json(url: str, params=None):

res = requests.get(url, headers=HEADERS, params=params, timeout=15)

res.raise_for_status()

return res.json()

def source_hash(post: dict) -> str:

return hashlib.sha256(f"{post['platform']}:{post['external_id']}".encode()).hexdigest()

def load_hashes() -> set[str]:

if HASH_FILE.exists():

    return set(json.loads(HASH_FILE.read_text()))

return set()

def save_hashes(hashes: set[str]) -> None:

HASH_FILE.write_text(json.dumps(sorted(hashes), indent=2))

def fetch_hn(since: int, until: int) -> list[dict]:

posts, seen = [], set()

for phrase in INTENT_SEARCH_PHRASES:

    for tags in ("ask_hn", "story", "comment"):

        for page in range(2):

            data = get_json(

                "[https://hn.algolia.com/api/v1/search_by_date](https://hn.algolia.com/api/v1/search_by_date)",

                {

                    "query": phrase,

                    "tags": tags,

                    "numericFilters": f"created_at_i>={since},created_at_i<{until}",

                    "hitsPerPage": 50,

                    "page": page,

                },

            )

            hits = data.get("hits") or []

            for hit in hits:

                object_id = hit.get("objectID")

                if not object_id or object_id in seen:

                    continue

                title = (hit.get("title") or hit.get("story_title") or "HN comment").strip()

                body = hit.get("comment_text") or hit.get("story_text") or ""

                if tags == "comment" and not SOFTWARE_QUALIFIER.search(f"{title}\n{body}"):

                    continue

                seen.add(object_id)

                posts.append(

                    {

                        "platform": "hackernews",

                        "external_id": str(object_id),

                        "source": "hackernews",

                        "url": f"[https://news.ycombinator.com/item?id={object_id}](https://news.ycombinator.com/item?id=%7Bobject_id%7D)",

                        "title": title,

                        "body": strip_html(body),

                        "author": hit.get("author"),

                    }

                )

            if not hits or page + 1 >= data.get("nbPages", 1):

                break

            time.sleep(0.15)

return posts

def fetch_devto(since_ms: int, until_ms: int) -> list[dict]:

posts, seen = [], set()

for tag in ("help", "discuss"):

    reached_old = False

    for page in range(1, 6):

        items = get_json(

            "[https://dev.to/api/articles](https://dev.to/api/articles)",

            {"per_page": 30, "page": page, "tag": tag},

        )

        if not items:

            break

        for item in items:

            item_id = item.get("id")

            published = item.get("published_at")

            posted_ms = (

                datetime.fromisoformat(published.replace("Z", "+00:00")).timestamp() * 1000

                if published

                else None

            )

            if posted_ms is not None and posted_ms < since_ms:

                reached_old = True

                continue

            if not item_id or item_id in seen:

                continue

            if posted_ms is not None and not (since_ms <= posted_ms < until_ms):

                continue

            seen.add(item_id)

            username = (item.get("user") or {}).get("username") or "dev"

            posts.append(

                {

                    "platform": "devto",

                    "external_id": str(item_id),

                    "source": "devto",

                    "url": item.get("url") or f"[https://dev.to/{username}/{item.get('slug](<https://dev.to/%7Busername%7D/%7Bitem.get('slug>)', item_id)}",

                    "title": (item.get("title") or "").strip(),

                    "body": (item.get("description") or "").strip(),

                    "author": username,

                }

            )

        if reached_old:

            break

        time.sleep(0.8)

return posts

def fetch_software_recs(since: int, until: int) -> list[dict]:

posts = []

for page in range(1, 4):

    data = get_json(

        "[https://api.stackexchange.com/2.3/questions](https://api.stackexchange.com/2.3/questions)",

        {

            "order": "desc",

            "sort": "creation",

            "site": "softwarerecs",

            "pagesize": 50,

            "page": page,

            "filter": "withbody",

            "fromdate": since,

            "todate": until,

        },

    )

    for item in data.get("items") or []:

        question_id = item.get("question_id")

        if not question_id or not item.get("title"):

            continue

        owner = (item.get("owner") or {}).get("display_name")

        posts.append(

            {

                "platform": "stackexchange",

                "external_id": str(question_id),

                "source": "softwarerecs",

                "url": item.get("link")

                or f"[https://softwarerecs.stackexchange.com/questions/{question_id}](https://softwarerecs.stackexchange.com/questions/%7Bquestion_id%7D)",

                "title": item["title"].strip(),

                "body": strip_html(item.get("body") or ""),

                "author": owner,

            }

        )

    if not data.get("has_more"):

        break

    time.sleep(0.8)

return posts

def match_keywords(text: str, keywords: list[str]) -> list[str]:

haystack = " ".join(text.lower().split())

return [k for k in keywords if k.lower() in haystack]

def is_loose_buying_candidate(title: str, body: str) -> bool:

text = f"{title}\n{body}"

return bool(SOFTWARE_QUALIFIER.search(text) and any(cue.search(text) for cue in BUYING_QUESTION_CUES))

def to_candidates(posts: list[dict]) -> list[dict]:

keyword_hits, loose_hits = [], []

for post in posts:

    if post["platform"] == "stackexchange" and post["source"] == "softwarerecs":

        keyword_hits.append({**post, "matched_keywords": ["softwarerecs"]}) continue
    matched = match_keywords(f"{post['title']}\n{post['body']}", KEYWORDS)
    if matched:
        keyword_hits.append({**post, "matched_keywords": matched})

def parse_json_safe(raw: str | None):

if not raw:

    return None

text = re.sub(r"[\s\S]*?**", "", raw, flags=re.I).strip()
candidates = re.findall(r"`(?:json)?\s*([\s\S]*?)`", text, flags=re.I)
candidates.append(text)
start = text.find("{")
end = text.rfind("}")
if start != -1 and end > start:
    candidates.append(text[start : end + 1])
for candidate in candidates:
    repaired = candidate.replace("“", '"').replace("”", '"').replace("’", "'")
    repaired = re.sub(r",\s*([}]])", r"\1", repaired)

    try:

        return json.loads(repaired)

    except json.JSONDecodeError:

        continue

return None

def validate_analysis(raw) -> dict | None:

if not isinstance(raw, dict):

    return None

try:

    score = min(10, max(1, int(round(float(raw.get("intent_score"))))))

except (TypeError, ValueError):

    return None

category = str(raw.get("category") or "").strip().lower().replace("-", "*").replace(" ", "*")

if category not in CATEGORIES:

    return None

summary = " ".join(str(raw.get("problem_summary") or "").split()).strip()

if len(summary) < 5:

    return None

urgency = str(raw.get("urgency") or "").strip().lower()

if urgency not in URGENCIES:

    urgency = "low"

tools, seen = [], set()

for item in raw.get("mentioned_tools") or []:

    if not isinstance(item, str):

        continue

    name = item.strip()[:60]

    if not name or name.lower() in seen:

        continue

    seen.add(name.lower())

    tools.append(name)

    if len(tools) >= 15:

        break

return {

    "intent_score": score,

    "category": category,

    "problem_summary": summary[:500],

    "mentioned_tools": tools,

    "urgency": urgency,

}

def analyse(client: OpenAI, model: str, post: dict) -> dict | None:

body = post["body"]

if len(body) > BODY_MAX_CHARS:

    body = body[:BODY_MAX_CHARS] + "…"

source = f" ({post['source']})" if post.get("source") else ""

user = f"Platform: {post['platform']}{source}\nTitle: {post['title']}\nBody: {body or '(empty)'}"

completion = client.chat.completions.create(

    model=model,

    temperature=0.1,

    max_tokens=2000,

    messages=[

        {"role": "system", "content": SYSTEM_PROMPT},

        {"role": "user", "content": user},

    ],

)

parsed = parse_json_safe(completion.choices[0].message.content)

return validate_analysis(parsed)

def main() -> None:

now = datetime.now(timezone.utc)

until = int(now.timestamp())

since = until - LOOKBACK_HOURS * 3600

since_ms, until_ms = since * 1000, until * 1000
posts = fetch_hn(since, until) + fetch_devto(since_ms, until_ms) + fetch_software_recs(since, until)
known = load_hashes()
fresh = [p for p in posts if source_hash(p) not in known]
queued = to_candidates(fresh)[:MAX_AI_CALLS]
print(f"fetched={len(posts)} new={len(fresh)} to_analyse={len(queued)}")

client = OpenAI(base_url=os.getenv("OPENAI_BASE_URL") or None)
model = os.getenv("OPENAI_MODEL") or "gpt-4o-mini"
kept = 0
for post in queued:
    digest = source_hash(post)
    try:
        analysis = analyse(client, model, post)
    except Exception as exc:
        print(f"failed {post['url']}: {exc}")
        continue
    known.add(digest)
    if not analysis:
        print(f"invalid JSON {post['url']}")
        continue
    if analysis["intent_score"] < MIN_INTENT_THRESHOLD:
        print(f"reject {analysis['intent_score']} {post['title'][:80]}")
        continue
    kept += 1
    print("=" * 72)
    print(f"{analysis['intent_score']}/10  {analysis['category']}  {analysis['urgency']}")
    print(post["title"])
    print(analysis["problem_summary"])
    print("tools:", ", ".join(analysis["mentioned_tools"]) or "(none)")
    print(post["url"])

save_hashes(known)
print(f"kept={kept}  remembered_hashes={len(known)}")

if name == "main":

main()

`

If you put this on a schedule, keep the per-run cap, persist hashes, and do not poll faster than the forums themselves update. Be conservative in how you follow up: these are public posts, not a license to spam. Read the thread, and if you reach out, talk about the actual problem in the post.

A useful later upgrade, which I run in production on Sundays, is to look at yield (accepted vs analysed) by source and keyword, and adjust the keyword list and the threshold with guardrails — for example a minimum and maximum number of keywords, and no more than a one-point threshold change at a time. Do not let a model freely rewrite the strategy without those bounds.

I expose the same scored feed as B2B Buying Intent Signals on RapidAPI. Collection covers Reddit, Hacker News, Lobsters, Dev.to, and Software Recommendations, every six hours. The default list is score 7+. At the time of writing the live feed holds ~100 high-intent B2B signals.

`bash

curl --request GET \

--url 'https://b2b-buying-intent-signals.p.rapidapi.com/api/v1/signals?tool=shopify&min_score=7&limit=10' \

--header 'X-RapidAPI-Host: b2b-buying-intent-signals.p.rapidapi.com' \

--header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY'

`

You can also filter by tool (a case-insensitive exact match on mentioned_tools, so tool=shopify matches "Shopify"), category, platform, and urgency. Tools that actually appear in the current feed include Shopify, Supabase, Veeqo, Vesyl, Stripe, Railway, Lovable, Bolt and GitHub — useful starting filters if you sell into ecommerce, payments, or hosting. There is a free BASIC plan (200 calls/month) if you want to inspect real payloads before deciding whether to run any of this yourself.

If you would rather stay in code, the script above is the whole idea: cheap filters first, a strict JSON contract second, and a threshold that is allowed to say "no."

── more in #ai-tools 4 stories · sorted by recency
── more on @hacker news 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-i-detect-b2b-buy…] indexed:0 read:17min 2026-11-21 · —