Back to use cases

    Use case / X DATA / Python 3 / Published

    Build a Launch Video Swipe File from X Video Posts in Python

    Name your category and get the most-liked public X launch and demo video posts from the last 30 days, grouped by how each post opens, as a CSV and Markdown.

    Card for Build a Launch Video Swipe File from X Video Posts in Python

    This launch video swipe file is a small Python script for founders and marketers planning a launch video. Name your category and a few terms, and get back the most-liked public X video posts with launch or demo wording from the last 30 days, grouped by how each post opens, as swipe.csv and swipe.md. It gives you a list of references to watch, not a ranking of the best launch videos.

    The problem

    Before you record a launch video you want to see how other makers in your category opened theirs. Finding those posts by hand means scrolling search results, opening each video and copying links into a doc. Older well-liked posts and this week's launches show up in different places, so it is easy to miss one or the other. A short, sorted list per category saves that hour.

    What the swipe file app does

    • Takes a category name plus the terms people write in launch posts, for example "iOS app" or "App Store".
    • Searches public X video posts with launch wording (launch, launching, introducing, demo) from the last 30 days with at least 50 likes (both adjustable).
    • Keeps one post per author, most-liked first, top 15.
    • Refreshes likes, reposts and replies for the final 15 posts by URL.
    • Groups each post by its opening: announcement, demo-first, problem-first, founder talking, before/after or other.
    • Writes swipe.csv and swipe.md with links in x.com/i/status/<id> form. Individual authors show as "a creator"; pass --brand <account> to name an org or brand account.

    How it works

    1. Search for launch videos. GET /twitter with query=(launch OR launching OR introducing OR demo) ("<term 1>" OR "<term 2>" ...), is_video=true, min_likes, start_date 30 days ago and count 50. One pass sorted Top and one sorted Latest.
    2. Filter in code too. Keep posts with a video in media, at least min_likes likes and a date on or after the start day, one per author.
    3. Refresh the numbers. GET /twitter/urls with the 15 post URLs as repeated urls= parameters copies the latest metrics onto each post.
    4. Group by opening. The first 200 characters of the text decide the group, using the regex rules in core.OPENINGS.
    5. Write the files. swipe.csv, swipe.md and a snapshot.json with per-pass counts.

    The code

    The core of the example, copied from swipe.py. The key comes from DESEARCH_API_KEY_FILE or the DESEARCH_API_KEY env var:

    PYTHON
    def api_key():
        path = os.environ.get("DESEARCH_API_KEY_FILE")
        key = pathlib.Path(path).expanduser().read_text().strip() if path else os.environ.get("DESEARCH_API_KEY", "").strip()
        if not key:
            raise SystemExit("Set DESEARCH_API_KEY_FILE (a file holding your key from console.desearch.ai) or DESEARCH_API_KEY")
        return key
    PYTHON
    def search(c, tag, query, start, count, sort, **flt):
        params = {"query": query, "sort": sort, "start_date": start, "count": count, **{k: v for k, v in flt.items() if v is not None}}
        st, res = c.call("GET", "/twitter", tag, params)
        return st, (res if st == 200 and isinstance(res, list) else [])

    The key goes only in the Authorization header. The folder layout:

    • swipe.py: the CLI and the plain-HTTP Desearch client, which logs each call to calls.jsonl.
    • core.py: query builder, filters, opening rules and output files. No network.
    • test_swipe.py: offline tests.
    • samples/: swipe.csv and swipe.md from the sample run.

    Endpoints

    • GET /twitter
    • GET /twitter/urls

    Example output

    A sample run on 2026-10-14 at 09:30 (Asia/Tbilisi) for the category "mobile apps" (terms "iOS app", "mobile app", "Android app", "App Store"), 30 days, at least 50 likes. This page shows that stored request and response. It does not run a live demo.

    Sample request

    GET /twitter, once sorted Top and once sorted Latest. The saved query and filters from that run:

    JSON
    {
      "query": "(launch OR launching OR introducing OR demo) (\"iOS app\" OR \"mobile app\" OR \"Android app\" OR \"App Store\")",
      "sort": "Top",
      "start_date": "2026-09-14",
      "count": 50,
      "is_video": "true",
      "min_likes": 50
    }

    The second pass uses the same fields with "sort": "Latest". With --compare, two more Top passes run (video only, and likes only). Then GET /twitter/urls refreshes the 15 kept posts.

    Sample response

    What came backCount
    Posts from the Top pass26
    Posts from the Latest pass50
    Unique posts61
    Posts kept (one per author)15
    Kept posts with a video15 of 15
    Most likes on a kept post6,015
    Opening group in swipe.mdPosts
    announcement11
    demo-first2
    problem-first1
    other1

    Most kept posts opened as announcements ("Introducing ..."). In a hand check of 20 returned posts from the same run, 12 were launches or demos and the rest were news, recaps or promos that used launch wording, so watch each one before you use it as a reference.

    Run it yourself

    BASH
    git clone https://github.com/Desearch-ai/desearch-py-examples && cd desearch-py-examples/launch-video-swipe-file
    export DESEARCH_API_KEY=...   # from console.desearch.ai
    python swipe.py "mobile apps" --terms "iOS app" "mobile app" "Android app" "App Store" --min-likes 50
    • --terms: the words people write in launch posts for your category. Broader terms find more posts.
    • --days, --min-likes, --top: the window, the like threshold and how many posts to keep.
    • --compare: adds two Top passes (video only, likes only) and writes their overlap to snapshot.json.

    What it costs

    Measured on 2026-10-14 from the X-Desearch-Cost-Usd header: the sample run with --compare (4 X Search passes and 1 /twitter/urls call) cost $0.02115. Each call's cost is saved in calls.jsonl. See pricing.

    Ideas to extend it

    • Run it every Monday for your category and keep a growing swipe file.
    • Add a column for your own notes after you watch each video.
    • Compare two categories side by side to see which openings each one favours.

    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 <DESEARCH_API_KEY>"
          }
        }
      }
    }

    Prompt you can paste for this example:

    Use Desearch GET /twitter to find public X video posts with launch or demo wording for the category and terms I name, from the last 30 days, with at least 50 likes. Keep one post per author, refresh likes, reposts and replies, and group each post by how the text opens. Return a CSV and Markdown with links in x.com/i/status form. Show individual authors as a creator. Do not invent posts.

    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