Skip to content

Latest commit

 

History

166 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Desearch SDK Examples

This document provides examples of how to use the Desearch SDK to perform various types of searches. The Desearch SDK allows you to interact with multiple platforms and retrieve data using a unified interface.

Setup

Create and activate a virtual environment:

python3 -m venv venv
source venv/bin/activate

Install dependencies:

pip3 install desearch-py==1.2.1

Examples

1. Web Links Search

The Web Links Search allows you to search for web links using a specific query. Here's how you can perform a web links search:

import asyncio
from desearch_py import Desearch

async def main():
    async with Desearch(api_key="your-api-key") as desearch:
        result = await desearch.ai_web_links_search(
            prompt="Bittensor",
            tools=["web"],
            count=10,
        )
        print(result)

asyncio.run(main())

2. AI Search

The AI Search provides a more comprehensive search experience by utilizing AI models to gather and summarize information from various sources:

import asyncio
from desearch_py import Desearch

async def main():
    async with Desearch(api_key="your-api-key") as desearch:
        result = await desearch.ai_search(
            prompt="Bittensor",
            tools=[
                "web",
                "twitter",
            ],
            date_filter=None,
            result_type="LINKS_WITH_FINAL_SUMMARY",
            system_message="You are a helpful assistant.",
            count=10,
        )
        print(result)

asyncio.run(main())

3. Basic Twitter Search

The Basic Twitter Search allows you to search for tweets based on specific criteria:

import asyncio
from desearch_py import Desearch

async def main():
    async with Desearch(api_key="your-api-key") as desearch:
        # desearch-py 1.2.1: x_search calls GET /twitter.
        # Pass boolean filters as "true" / "false" strings. See basic_twitter_search.py.
        result = await desearch.x_search(
            query="Bittensor",
            sort="Top",
            start_date="2026-01-01",
            end_date="2026-10-01",
            lang="en",
            blue_verified="true",
            is_video="true",
            min_retweets=1,
            min_replies=1,
            min_likes=1,
            count=10,
        )
        print(result)

asyncio.run(main())

4. Twitter Retweets and Replies

You can also retrieve retweets and replies for a specific tweet using its ID:

import asyncio
from desearch_py import Desearch

async def main():
    async with Desearch(api_key="your-api-key") as desearch:
        # Users who reposted a post. desearch-py 1.2.1: x_post_retweeters(id, cursor).
        result = await desearch.x_post_retweeters(id="123456789")
        print(result)

        # Replies to a post. See twitter_replies_post.py.
        result = await desearch.x_post_replies(post_id="1276418907968925696", count=10)
        print(result)

asyncio.run(main())

x_post_replies returns up to count replies; older posts may return fewer.

These examples demonstrate how to use the Desearch SDK to perform various types of searches. You can customize the queries and parameters to suit your specific needs. Make sure to replace "your-api-key" with your actual API key to authenticate your requests.

Example apps

  • Morning Topic Brief: Python CLI that builds a morning brief on chosen topics with the Desearch API.
  • Token Narrative Pulse: Python CLI that tracks X narrative and mention volume for crypto tokens with the Desearch API.
  • Comment Voice-of-Customer Report: Python CLI that pulls public comments from a brand's recent Instagram and TikTok posts and sorts them into questions, complaints, requests, praise and other.
  • Ad Library Angle Log: Python CLI that logs public Ad Library angles for a store and diffs them over time with the Desearch API.
  • City Trends Pulse: Python CLI that compares X trends across cities and countries, pulls the top posts per trend and checks their relevance, freshness and language with the Desearch API.
  • TikTok Trend Board: Python CLI that builds a daily board of TikTok trending posts and hashtags per region, with hashtag drill-downs and top-post comments, with the Desearch API.
  • Instagram Creator Shortlist: Python CLI that turns a niche keyword into a ranked shortlist of Instagram creators by follower tier, engagement rate and posting cadence with the Desearch API.
  • YouTube Angle Finder: Python CLI that finds YouTube videos on a niche and writes an angles and gaps brief with the Desearch API.
  • YouTube Creator Finder: Python CLI that turns a plain-language description into a CSV of matching YouTube creators, with fit scores and public contacts when listed, using the Desearch API People Search.
  • Topic to RSS: Python CLI that turns a topic into an RSS 2.0 feed of dated search results with the Desearch API, dropping undated pages, removing duplicates and sorting newest first, with no packages to install.
  • AI Answer Check: Python CLI that checks whether an AI answer names your brand on buyer questions with the Desearch API.
  • Agent Search Toolbelt: Python research agent that answers a question with four Desearch MCP tools and writes a run log of each call.
  • Arxiv Chatter Digest: Python CLI that digests recent arXiv papers on a topic and the public X posts that named them with the Desearch API.
  • Complaint Radar: Python CLI that sorts recent public X complaint posts about a brand into themes with the Desearch API.
  • Forum Intent Board: Python CLI that lists public Hacker News and Reddit threads asking for a tool with the Desearch API.
  • Hashtag Shortlist: Python CLI that ranks candidate TikTok and Instagram hashtags for a niche by median likes, freshness and creator spread with the Desearch API.
  • Hiring Signal Radar: Python CLI that finds companies hiring for a role from public posts and job pages with the Desearch API.
  • Holiday Promo Watch: Python CLI that snapshots Black Friday promo wording on brand sites and social posts with the Desearch API.
  • Reply Ledger: Python CLI that turns a public X account's recent posts and replies into a reply ledger with the Desearch API.
  • Investor Topic Tracker: Python CLI that builds a reading list of public investor posts on a topic with the Desearch API.
  • Listicle Gap Finder: Python CLI that finds roundup pages naming competitors but not your brand with the Desearch API.
  • Posting Time Check: Python CLI that scores posting time by weekday and hour for TikTok, Instagram and Facebook accounts with the Desearch API.
  • Repo Buzz Tracker: Python CLI that tracks public X posts and web pages mentioning a GitHub repo with the Desearch API.
  • RAG Corpus Builder: Python CLI that builds a starter corpus from ranked web pages on a topic with the Desearch API.
  • Tweet Scraper to CSV: Python CLI that writes public X posts for a query to a clean CSV with the Desearch API.
  • Page to Markdown: Python CLI that turns a list of URLs into clean Markdown files with the Desearch API.
  • SERP API Rank Checker: Python CLI that reports the best rank a domain got for each keyword in the web results Desearch returned with the Desearch API.
  • Launch Quote Ledger: Python CLI that collects quote posts of a product launch on X and notes disclosure wording with the Desearch API.
  • Social Listening Report: Python CLI that pulls recent public X posts and web pages for a brand into a listening sheet with the Desearch API.
  • Market Research Brief: Python CLI that drafts a short market brief from web pages and recent posts with the Desearch API.
  • X Trends Dashboard: Python CLI that compares X trends across places and writes a static HTML dashboard with the Desearch API.
  • Trending Hashtags Finder: Python CLI that pulls X trend lists by location, keeps hashtags only, merges them across countries, checks activity on the latest posts and writes a use, cooling or skip verdict with the Desearch API.
  • TikTok Scraper to CSV: export public TikToks for a keyword and hashtag to one clean CSV.
  • Brand Mentions Finder: Saved prompt and Python CLI that lists third-party web pages and public X posts about a brand with the Desearch API.
  • X Keyword Monitor: Saved prompt and Python CLI that lists new public X posts for a few keywords since the last check with the Desearch API.
  • Podcast Guest Shortlist: Saved prompt and Python CLI that builds a podcast guest shortlist from public X posts and web pages with the Desearch API.
  • TikTok Comments Export: export public comments from TikTok videos to one clean CSV.
  • Tweet Search Web App: one-page web app to search X posts with filters and export CSV.
  • Reddit Search (MCP): Saved prompt and Python CLI that searches Reddit threads on a topic through the Desearch MCP ai-search tool and prints links, a short summary and the cost.
  • arXiv Paper Search to CSV: search arXiv papers by topic and export one clean, deduplicated CSV.
  • X User Lookup App: look up an X account's recent posts in a small web app or CLI and export CSV.
  • Web Search API Quickstart: a tiny search endpoint and page on top of the Desearch web search API, with curl, Python and JS snippets.
  • Find X Influencers (MCP): Saved prompt and Python CLI that finds active X voices on a topic through the Desearch MCP x-search tool, ranked by posts and likes with follower counts.
  • News Monitoring to CSV: track topics across the web and X and append only new items to one CSV.
  • Launch Video Swipe File: collect product launch video posts from X into a CSV and Markdown swipe file.
  • Directory Finder: type a category and get the directories that accept submissions, with a CSV and a shortlist.
  • Hacker News Search App: search Hacker News discussions with Desearch AI search (hackernews tool), export JSON or CSV.
  • Instagram Engagement Rate Calculator: Python CLI that computes the engagement rate of a public Instagram account from its latest posts, with the formula shown and a split by format (image, carousel, video/reel), using the Desearch API.
  • Content Ideas Finder (MCP): Saved prompt and Python CLI that turns questions from Reddit, Hacker News and X into a content plan with a source link per idea, through the Desearch MCP ai-search and x-search tools.
  • AI Fact Checker: paste one claim and get web sources that back it or push back on it, a summary that keeps only cited sentences, and related X posts, in a small web app or CLI (deploys to Vercel).
  • AI News Today Board: Python script that builds a once-a-day board of AI posts and tech news pages from a fixed query plan, deduped, tagged by sub-query and marked new against a seen-links file, using the Desearch API.
  • Article Summarizer (MCP): Saved prompt and Python CLI that reads one public article with the Desearch MCP extract tool and lists its key points and the numbers it mentions, quoted from the page, with optional links to other coverage through ai-search.
  • AI Search Engine Web App: Small web app, JSON endpoint and CLI that search the web with the Desearch Search API (POST /search) and show ranked pages with their published date and best-matching passage, a date-range filter and a fast/balanced toggle, plus an optional answer shown only next to the links it cites. Deploys to Vercel.
  • Web Links Search Demo: Hosted live demo and JSON endpoint that send one prompt to the Desearch AI Search links endpoint (POST /desearch/ai/search/links/web) and show ranked web links with title, domain, snippet and date when the source has one, with per network limits and a cache. Deploys to Vercel.
  • Article Summarizer Demo: Hosted live demo and JSON endpoint that quote key article sentences and numbers with the Desearch extract endpoint, with per network limits and a cache. Deploys to Vercel.
  • Reddit Search Demo: Hosted live demo and JSON endpoint that list public Reddit threads with one Desearch web search, with per network limits and a cache. Deploys to Vercel.
  • Who's Asking For It (MCP): Social listening on X with a saved prompt and a Python CLI: recent public X posts about a topic, kept inside your date window, through the Desearch MCP x-search tool, with a rough first-pass label.
  • TikTok Profile Analytics to CSV: per-post metrics and a per-profile summary (posts per week, median views, engagement rate, best weekday) for a few public TikTok accounts.
  • Wikipedia Primer (MCP): Wikipedia search API for agents through the Desearch MCP ai-search tool: a saved prompt and Python CLI that keep only real articles with matching titles and build a short primer with a link after each fact and an optional web cross-check.
  • Deep Research Report: Python script that turns one research question into a cited, dated markdown report and source CSV, quoting sentences from pages returned by the Desearch Search API with their links and published dates.
  • X Account Analytics: Python script that turns the latest posts of one public X account into a per-post engagement CSV and a markdown summary (engagement rate per view and per follower, posts per day, best weekday and hour, top posts, split by post type and media), using the Desearch API through the desearch-py SDK.
  • Instagram API Quickstart: Python CLI and curl/Python snippets that read public Instagram profiles, posts, comments and hashtag media with one Desearch API key, follow the cursor header for paging and print the cost of every call.
  • Plagiarism Checker: Python CLI that checks whether sentences from a text already appear on public web pages, with Desearch Web Search for exact phrases and Extract to confirm each match on the page, a cost estimate before any paid call, and a CSV of matching sources with overlap scores.
  • Pricing Page Snapshot (MCP): Saved prompts and Python CLI that read pricing pages through the Desearch MCP extract tool, build a plan and price table from the page text, and compare it with an earlier snapshot.
  • Stock Twitter Ticker Pulse: Python CLI that builds a daily board of public X cashtag posts for a stock watchlist, filtering pump-group spam and off-topic posts, with the Desearch API and no packages to install.
  • Social Media Username Checker: Python CLI that checks one or more handles on Instagram, TikTok, X and Facebook and reports "public profile found", "no public profile found" or "could not check" for each, with cost per call, using the Desearch API and no packages to install.
  • Scholarship Finder: Python CLI that finds scholarship pages for a field of study, level and year, pulls the deadline dates stated on those pages, drops past deadlines and lists the rest by nearest deadline with a link to each source, using the Desearch API and no packages to install.

Releases

Packages

Contributors

Languages