Interface description: Create a Search API collection task via the API to obtain real-time web page search results, and collect the corresponding web page text as needed.
Request address: https://aiwebapi.dataify.com/search
Request method: POST
Request format: application/json or application/x-www-form-urlencoded
Headers:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Fixed format: Authorization: Bearer <Your YOUR_API_TOKEN>. Your_API_TOKEN can be obtained in Dashboard → Settings → Token Management. Custom Token request headers are not supported. |
Body:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
unique_id | string | Yes | Used to specify the tool to use, fixed parameters: search_web(Search API), search_news(News Search), search_shopping(Shopping Search), search_scholar(Scholar Search) |
query | string | Yes | The search terms used for querying should be 1 to 256 characters long after removing leading and trailing spaces. Additionally, (1) search terms are in keyword form and natural language decomposition queries are not currently supported. (2) When source=web, keyword restriction is supported; the input format is: site:domain keyword |
source | enum | No | Type used to set the results collected. Optional value: web, news, shopping, scholar, Default value is web. |
max_results | integer | No | Sets the maximum number of search results to return, ranging from 1 to 100, the default value is 10. |
time_range | enum | No | Time frame for setting search results. Optional Value: hour(Last 1 hour), day(The past 24 hours), week(Last 1 week), month(Last month), year(Over the past 1 year. Not passing a value indicates that there is no time limit.shopping and scholar Type does not support this parameter. |
country | string | No | Used to set the country or region for search results, using a two-letter lowercase country code. The default value is us. This parameter is not supported by the scholar type. |
language | string | No | The interface language used to set search results, the default value is en. |
extract_content | boolean | No | Used to set whether to further collect the webpage content corresponding to each URL in the search results. Possible values: false, true; default value is false. |
extract_options | object | No | Used to configure parameters for webpage content collection. This parameter can only be passed if extract_content is true. |
extract_options.formats | array of string | No | Output format for setting the main text of the web page. Optional Value: markdown, raw_html, clean_html, links, Default value is markdown. |
extract_options.include_tags | array of string | No | Used to specify that only content corresponding to a specified HTML tag or CSS Selector should be retained during data collection. Maximum of 50 entries, each with a maximum length of 2048 UTF-8 bytes. For example: ["data-testid=qsp-price1","data-testid=qsp-price2"]. |
extract_options.exclude_tags | array of string | No | This is used to specify the HTML tags or CSS selectors to be removed during data collection. A maximum of 50 entries are allowed, each with a maximum length of 2048 UTF-8 bytes. For example: ["data-testid=qsp-price1","data-testid=qsp-price2"]. |
extract_options.only_main_content | boolean | No | This setting determines whether to retain only the cleaned main content. true means retaining only the cleaned main content; false means retaining more of the cleaned page content. The default value is true. |
extract_options.advanced_mode | boolean | No | This setting configures the webpage scraping method. false indicates using HTTP scraping without rendering; true enables an automatic unlocking strategy, sequentially attempting scraping without rendering, scraping with browser rendering, and scraping with browser rendering combined with a webpage unlocker, only proceeding to the next level after the previous level fails. Different scraping methods have different costs; please refer to the pricing details. The default value is true. |
extract_options.timeout_ms | integer | No | The maximum processing time used to set the body of a single web page to be collected, covering the acquisition, rendering and extraction process, in milliseconds. range 1000~120000, Default value is 60000. |
extract_options.wait_for_ms | integer | No | This setting determines the system loading time in milliseconds when collecting content pages. The value range is 0 to 30000. The default value is 0. When passed together with timeout_ms, wait_for_ms must not exceed half of timeout_ms. |
extract_options.max_age_ms | integer | No | This setting determines the maximum acceptable cache duration when collecting content pages, in milliseconds. The value range is 0 to 172,800,000 (2 days); setting it to 0 forces a cache pull from the origin server. Default values are not specified in the original parameter table. |
{
"markdown": "# News"
}
| Parameter Name | Parameter Type | Description |
|---|---|---|
title | string | Title of the search result. |
url | string | The URL address corresponding to the search results. |
snippet | string | Summary of Search Results. |
date | string | The date of the news article corresponding to the search results. |
extract | object | The webpage content and page information corresponding to the search result URL. |