综合搜索(支持分页)/General search (with pagination)

Instagramapi

About

综合搜索(支持分页)/General search (with pagination)

Documentation

综合搜索(支持分页)/General search (with pagination)

[中文]

用途:

  • Instagram综合搜索接口(支持分页)
  • 支持通过 next_max_id 分页获取大量搜索结果
  • 返回用户、话题标签、地点等综合结果

参数:

  • query: 搜索关键词
  • next_max_id: 分页ID,首次请求不传,从上一次响应的 data.next_max_id 获取
  • rank_token: 排序token,首次请求不传,从上一次响应的 data.rank_token 获取
  • enable_metadata: 是否启用元数据

返回:

  • data.num_results: 结果数量
  • data.users: 用户搜索结果列表
  • data.places: 地点搜索结果列表
  • data.hashtags: 话题标签搜索结果列表
  • data.next_max_id: 下一页分页ID(传给下次请求的next_max_id参数)
  • data.rank_token: 排序token(传给下次请求的rank_token参数)
  • data.has_more: 是否有更多结果

注意事项:

  • ⚠️ 已知问题: 综合搜索结果可能存在重复数据,这是 Instagram API 的已知行为
  • 搜索话题标签时,query 需要带上 # 前缀,例如搜索 fashion 话题应传入 #fashion
  • # 符号在 URL 中需要进行 URL 编码为 %23,例如: ?query=%23fashion
  • 如果使用 HTTP 客户端库(如 requests/httpx),直接传入 #fashion 即可,库会自动处理编码

分页使用方法:

  1. 首次请求:只传 query 参数
  2. 获取响应中的 next_max_idrank_token
  3. 下次请求:传入 querynext_max_idrank_token
  4. 重复步骤 2-3 直到 has_more 为 false

价格:

  • 0.008 USD/请求

[English]

Purpose:

  • Instagram general search API (with pagination)
  • Support pagination via next_max_id to fetch more search results
  • Returns blended results of users, hashtags, places, etc.

Parameters:

  • query: Search keyword
  • next_max_id: Pagination ID, omit for first request, get from previous response data.next_max_id
  • rank_token: Rank token, omit for first request, get from previous response data.rank_token
  • enable_metadata: Enable metadata

Return:

  • data.num_results: Number of results
  • data.users: User search results
  • data.places: Place search results
  • data.hashtags: Hashtag search results
  • data.next_max_id: Next page pagination ID (use as next_max_id in next request)
  • data.rank_token: Rank token (use as rank_token in next request)
  • data.has_more: Whether has more results

Notes:

  • ⚠️ Known Issue: General search results may contain duplicate data, this is a known behavior of Instagram API
  • When searching for hashtags, query must include the # prefix, e.g., use #fashion to search for the fashion hashtag
  • The # character must be URL-encoded as %23 in the URL, e.g., ?query=%23fashion
  • If using an HTTP client library (e.g., requests/httpx), just pass #fashion directly and the library will handle encoding automatically

Pagination usage:

  1. First request: Only pass query parameter
  2. Get next_max_id and rank_token from response
  3. Next request: Pass query, next_max_id and rank_token
  4. Repeat steps 2-3 until has_more is false

Price:

  • 0.008 USD/request

示例/Example

query = "justin"

Imported from a validated TikHub OpenAPI document. Pricing must be reviewed before enabling.

Try 综合搜索(支持分页)/General search (with pagination)

Test this model in the Sandbase Playground with your own prompts.

Open in Playground

Related Models