Back to use cases

    Use case / SOCIAL DATA / Python 3 / Published

    Find YouTube Video Ideas: Covered Angles and Gaps with Python

    Find YouTube video ideas with Python. Search a niche, collect video titles and channels, and write a brief of covered angles and gaps with links.

    Card for Find YouTube Video Ideas: Covered Angles and Gaps with Python

    YouTube Angle Finder is a small Python script for creators and marketers looking for YouTube video ideas. Give it a niche or a product question and it finds YouTube videos on that topic, then writes a short brief: angles already covered, with links, and gaps that look thin.

    The problem

    Before making a video, creators want to know what already exists so they do not repeat it. Searching YouTube and noting each video's angle by hand is slow, and it is easy to miss the gaps that nobody has covered well.

    What the app does

    • Takes a niche or question in plain words.
    • Finds YouTube video links on the topic.
    • Gets each video's real title and channel from public YouTube oEmbed.
    • Writes a brief of covered angles, with links, and thin gaps.
    • Shows what the run cost.

    How it works

    1. Try the YouTube source. POST /desearch/ai/search with tools: ["youtube"]. If that source is not available for the request, the script switches to the web path below.
    2. Find videos. POST /desearch/ai/search with tools: ["web"], links only, and the prompt site:youtube.com <your question>.
    3. Titles. Public YouTube oEmbed (no key) for each video's title and channel.
    4. Brief. A second POST /desearch/ai/search with a summary and a system message listing the verified titles, so the brief is grounded in those videos.

    The code

    PYTHON
        def post(self, url: str, payload: dict, label: str) -> dict:
            log(f"POST {url} ({label}) tools={payload.get('tools')} result_type={payload.get('result_type')} "
                f"date_filter={payload.get('date_filter')}")
            t0 = time.perf_counter()
            r = requests.post(url, json=payload, timeout=180,
                              headers={"Authorization": self.key, "Content-Type": "application/json"})
            latency = time.perf_counter() - t0
            try:
                body = r.json()
            except ValueError:
                body = {"_non_json_body": r.text[:20000]}
            rec = {"when": now_local(), "label": label,
                   "request": {"method": "POST", "url": url,
                               "headers": {"Authorization": "<redacted>", "Content-Type": "application/json"},
                               "body": payload},
                   "status": r.status_code, "latency_s": round(latency, 2),
                   "content_type": r.headers.get("Content-Type"),
                   "cost_headers": {h: r.headers.get(h) for h in COST_HEADERS},
                   "response": body}
            self.calls.append(rec)
            log(f"HTTP {r.status_code} in {rec['latency_s']} s, content-type {rec['content_type']}, "
                f"cost ${rec['cost_headers']['X-Desearch-Cost-Usd']}")
            if self.raw_dir:
                Path(self.raw_dir).mkdir(parents=True, exist_ok=True)
                n = len(self.calls)
                Path(self.raw_dir, f"{self.tag}-{n}-{label}.json").write_text(json.dumps(rec, indent=2, ensure_ascii=False))
            return rec

    The snippet shows the web path the script uses for links. The folder has one script, angles.py, and a sample brief in sample-output.md.

    Endpoints

    • POST /desearch/ai/search

    Example output

    From runs on 2026-10-04 for "AI coding agents for solo founders": the brief lists the angles existing videos already take, each with links, and a short list of gaps that look thin. Each call cost $0.004.

    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: --links-only (video list only, one call), --count (results per source), --out-dir (where reports go), --replay PREFIX (re-render a saved run).

    What it costs

    Every successful POST /desearch/ai/search call cost $0.004 on 2026-10-04, so a brief on the web path (2 calls) is $0.008. See pricing.

    Ideas to extend it

    The brief keeps links beside the covered angles, so creators can open the videos while planning a topic. Public YouTube oEmbed supplies the real title and channel for each video. Change the niche or product question to use the same workflow for another brief.

    • Run it for 10 niche questions and pick the biggest gap.
    • Add view counts from the YouTube Data API.
    • Turn each gap into a draft outline.

    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 to find YouTube videos already published in the niche I name. Summarize the angles those videos cover and the gaps they leave. Link only videos you retrieve. Do not invent titles or view counts.

    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