← 返回 Skills 市场
hadifarnoud

Divar Api

作者 Hadi Farnoud · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
106
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install divar-api
功能描述
Use this skill whenever the user wants to search, query, or extract data from Divar (divar.ir) — Iran's largest classifieds platform. Triggers include: searc...
使用说明 (SKILL.md)

Divar API Skill

Divar uses a server-driven widget API (JSON over HTTPS, protobuf type annotations embedded via @type). All responses are lists of typed widget_type objects. Base URL: https://api.divar.ir.

Critical: form_data field types

Every filter field uses a typed wrapper. Wrong type = HTTP 400. Use this table exactly:

Field Wrapper Example
category str { "str": { "value": "residential-rent" } }
sort str { "str": { "value": "sort_date" } }
districts repeated_string { "repeated_string": { "value": ["920", "82"] } }
rooms repeated_string { "repeated_string": { "value": ["یک", "دو"] } }
rent number_range { "number_range": { "minimum": "20000000", "maximum": "60000000" } }
credit number_range { "number_range": { "minimum": "300000000", "maximum": "600000000" } }
size number_range { "number_range": { "minimum": "80", "maximum": "120" } }
balcony boolean { "boolean": { "value": true } }
parking boolean { "boolean": { "value": true } }

number_range min/max values are strings, not numbers. boolean value is a JS boolean (true/false), not a string.

Critical: category slugs

The API slug differs from the divar.ir URL path segment. Never use the URL segment as the slug.

API slug (category.str.value) URL path Persian
residential-rent rent-residential اجاره مسکونی
apartment-sell apartment-sell فروش آپارتمان
apartment-rent rent-apartment اجاره آپارتمان
buy-residential buy-residential فروش مسکونی
real-estate real-estate همه ملک
buy-commercial-property buy-commercial-property فروش اداری/تجاری
rent-commercial-property rent-commercial-property اجاره اداری/تجاری
rent-temporary rent-temporary اجاره کوتاه‌مدت

When in doubt, intercept a real browser request via DevTools to read the actual category.str.value.

Search endpoint

POST /v8/postlist/w/search

Verified working payload (residential rental, Tehran, tested 2026-04-01 → returned 24 listings):

{
  "city_ids": ["1"],
  "source_view": "SEARCH",
  "disable_recommendation": false,
  "search_data": {
    "form_data": {
      "data": {
        "category":  { "str":            { "value": "residential-rent" } },
        "districts": { "repeated_string": { "value": ["139","143","145","4162","75","78","82","920","921"] } },
        "rooms":     { "repeated_string": { "value": ["دو","یک"] } },
        "rent":      { "number_range":   { "minimum": "20000000",  "maximum": "60000000"  } },
        "credit":    { "number_range":   { "minimum": "300000000", "maximum": "600000000" } },
        "size":      { "number_range":   { "minimum": "80",        "maximum": "120"       } },
        "balcony":   { "boolean":        { "value": true } },
        "parking":   { "boolean":        { "value": true } }
      }
    },
    "server_payload": {
      "@type": "type.googleapis.com/widgets.SearchData.ServerPayload",
      "additional_form_data": {
        "data": { "sort": { "str": { "value": "sort_date" } } }
      }
    }
  }
}

Response: { "list_top_widgets": [...], "list_widgets": [...] }

Filter to widget_type === "POST_ROW" to get listings. Each POST_ROW has:

  • data.title — listing title (Persian)
  • data.middle_description_text — price string
  • data.bottom_description_text — relative time ("دقایقی پیش")
  • data.action.payload.token — unique post ID (use for detail/contact endpoints)
  • data.action.payload.web_info.district_persian — district name
  • data.image_count — number of photos

Pagination

Cursor-based. On page 1, no pagination_data. On page 2+, add:

{
  "pagination_data": {
    "@type": "type.googleapis.com/post_list.PaginationData",
    "last_post_date": "\x3CISO8601 from previous last post>",
    "page": 2,
    "layer_page": 2,
    "search_uid": "\x3Cuuid — keep constant for the session>",
    "cumulative_widgets_count": 24
  }
}

viewed_tokens is an optional gzip+base64 bloom filter for server-side deduplication — safe to omit.

Post detail

GET /v8/posts-v2/web/{token}

Returns sections (BREADCRUMB, HEADER, IMAGES, DETAILS) each containing widget arrays. Common detail widget types: KEY_VALUE (room count, floor, etc.), DESCRIPTION, IMAGE_GALLERY, MAP.

Contact info (requires auth)

POST /v8/postcontact/web/contact_info_v2/{token}

Body: {}. Returns widget_list with UNEXPANDABLE_ROW containing phone number. Returns RBAC: access denied without authentication.

Authentication

  • Cookie-based: token cookie + did (device ID) cookie, set by divar.ir on login.
  • Header: Authorization: Basic \x3Cjwt> — same JWT value as the token cookie.
  • The search endpoint works with session cookies alone when called same-origin from divar.ir.
  • Cross-origin calls (e.g. from a script) need the Authorization header explicitly.

Parsing a divar.ir search URL → API payload

When a user pastes a URL like: https://divar.ir/s/tehran/rent-residential/almahdi?balcony=true&credit=300000000-600000000&districts=920%2C82&rent=20000000-60000000&rooms=%D8%AF%D9%88%2C%DB%8C%DA%A9&size=80-120

Map query params to form_data fields:

URL param form_data field Wrapper
URL path segment (e.g. rent-residential) category → look up API slug str
districts=920,82,... districts repeated_string (split on ,)
rooms=دو,یک rooms repeated_string (split on ,)
rent=min-max rent number_range (split on -)
credit=min-max credit number_range (split on -)
size=min-max size number_range (split on -)
balcony=true balcony boolean
parking=true parking boolean
map_bbox=... not in form_data — belongs in /v8/mapview/viewport camera_info.bbox
map_place_hash=... not in form_data

For full API reference (all endpoints, widget system, map/geo, autocomplete, filters): → read references/api-reference.md

安全使用建议
This skill is a documentation-only helper for Divar's public/internal API and appears internally consistent. Before using it: 1) Do not paste your Divar session cookies, JWTs, or other secrets into the chat unless you explicitly want the agent to make authenticated requests on your behalf — sharing these gives full access to authenticated endpoints (contact info, user-specific data). 2) Manually inspect the SKILL.md/README for invisible control characters (the scanner flagged unicode-control-chars) or other hidden text. 3) Remember scraping or automating Divar may trigger rate limits, bot detection, or violate terms of service — respect robots and legal restrictions. 4) If you need contact info from authenticated endpoints, prefer to perform the authenticated request yourself (outside the skill) and paste only the non-sensitive results back into the agent. If you are not comfortable with these checks, do not install or use the skill.
功能分析
Type: OpenClaw Skill Name: divar-api Version: 1.0.0 The skill bundle provides comprehensive and legitimate documentation for interacting with the Divar.ir API. It includes detailed specifications for search, post details, and contact information endpoints, along with precise instructions on data types and category slugs (SKILL.md, divar-api-documentation.md). There is no evidence of malicious intent, data exfiltration, or unauthorized execution; the content is focused on enabling an AI agent to correctly format requests for a specific third-party service.
能力评估
Purpose & Capability
Name and description (Divar API/search/extract) match the provided SKILL.md and supplementary docs. All endpoints, payload formats, and examples are consistent with a documentation/scraping helper for divar.ir; there are no unrelated credentials, binaries, or install actions requested.
Instruction Scope
The SKILL.md gives detailed instructions for building search/detail/contact requests and documents authentication mechanisms (cookie + did, Authorization header). It does not itself request environment variables or tell the agent to read system files, but it does explain how to use session cookies/JWTs to fetch contact info. Because authenticated contact retrieval requires user session data, the user should not paste or expose Divar cookies/JWTs into the chat unless they understand the risk.
Install Mechanism
Instruction-only skill with no install spec and no code files — nothing will be written to disk or downloaded during installation.
Credentials
The skill declares no required environment variables, credentials, or config paths. The only sensitive items mentioned are Divar session cookies/JWTs needed for authenticated endpoints; those are expected for the described functionality but are not requested by the skill itself.
Persistence & Privilege
always is false and the skill does not request elevated or persistent system privileges. Autonomous invocation is allowed (platform default) but does not combine here with broad credentials or install behavior.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install divar-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /divar-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the Divar API skill for searching and extracting listing data from divar.ir. - Supports searching listings, filtering by multiple criteria (district, price, size, rooms, amenities), and paginating results. - Provides API usage details: payload structure, required field wrappers, category slug mapping, and example queries. - Explains how to parse divar.ir URLs into valid API queries and map filters to correct API fields. - Includes documentation for fetching post details and outlines authentication requirements for contact info.
元数据
Slug divar-api
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Divar Api 是什么?

Use this skill whenever the user wants to search, query, or extract data from Divar (divar.ir) — Iran's largest classifieds platform. Triggers include: searc... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 106 次。

如何安装 Divar Api?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install divar-api」即可一键安装,无需额外配置。

Divar Api 是免费的吗?

是的,Divar Api 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Divar Api 支持哪些平台?

Divar Api 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Divar Api?

由 Hadi Farnoud(@hadifarnoud)开发并维护,当前版本 v1.0.0。

💬 留言讨论