# 連結

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/on_page/links`

**Tags:** DataForSEO

依 `id` 取得爬取過程中發現的每個連結。用 `page_from` 和 `page_to` 篩選，取出從某個頁面出去或指向某個頁面的連結。傳回 `total_items_count`、`items_count`、`items`，以及用於分頁的 `search_after_token`——超過前幾頁後請用它，而不是 `offset`。讀取已完成的爬取，因此需要 `post_dataforseo_on_page_submit` 傳回的 `id`，並傳回 `crawl_progress` 以及 `crawl_status`（`max_crawl_pages`、`pages_in_queue` 與 `pages_crawled`）——在採信偏少的結果前先檢查這些欄位，因為仍在進行的爬取能回報的內容本來就少。💰 上游免費：查詢已完成的爬取不產生費用，只有爬取本身計費。

### 計費參考

- 計量方式：依回報的回應成本計量。
- 參考請求估算：0.012 美元。
- 參考客戶倍率：1.0。不得對已結算的客戶金額再次套用。

僅供參考的中繼資料，並非帳戶報價、保證價格或消費上限。資源額度並非 Felo 額度。最終費用依 Felo 計費記錄為準。

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **no**

### application/json

Schema:

```json
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "null"
    ],
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "<em>任務 ID</em><br><strong>必填欄位</strong><br>你可以在 <a href=\"https://docs.dataforseo.com/v3/on_page/task_post/\">Task POST</a> 端點的回應中取得此 ID<br>範例：<br>\"07131248-1535-0216-1000-17384017ad04\""
          },
          "page_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>頁面相對 URL</em><br>選填欄位<br>如果使用此欄位，API 回應將僅包含來自指定頁面的連結<br>請注意，此欄位僅能指定相對 URL"
          },
          "page_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>頁面相對 URL</em><br>選填欄位<br>如果使用此欄位，API 回應將僅包含指向指定頁面的內部連結<br>請注意，此欄位僅能指定相對 URL"
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>傳回連結的最大數量</em><br>選填欄位<br>預設值：<code>100</code><br>最大值：<code>1000</code>"
          },
          "offset": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>傳回連結在結果陣列中的位移量</em><br>選填欄位<br>預設值：<code>0</code><br>最大值：<code>2000000</code><br>如果指定 <code>10</code>，結果陣列中的前十個連結將被省略，並傳回後續連結的資料"
          },
          "filters": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "object",
                "null"
              ]
            },
            "description": "<em>結果篩選參數陣列</em><br>選填欄位<br><strong>可同時新增多個篩選條件（最多 8 個）</strong><br>應在條件之間設定邏輯運算子 <code>and</code>、<code>or</code><br>支援以下運算子：<br><code>regex</code>、<code>not_regex</code>、<code>=</code>、<code>&lt;&gt;</code>、<code>in</code>、<code>not_in</code>、<code>like</code>、<code>not_like</code><br>可在 <code>like</code> 與 <code>not_like</code> 中使用 <code>%</code> 運算子，比對任意長度（零個或多個字元）的字串<br>範例：<br><code>[\"direction\",\"=\",\"external\"]</code><p><code>[[\"domain_to\",\"&lt;&gt;\",\"example.com\"],<br>\"and\",<br>[\"link_from\",\"not_like\",\"%example.com/blog%\"]]</code><p><code>[[\"direction\",\"=\",\"external\"],<br>\"and\",<br>[[\"link_from\",\"like\",\"%example.com/blog%\"],\"or\",[\"link_from\",\"like\",\"%example.com/help%\"]]]</code><p>完整可用的篩選條件清單請見<a href=\"/v3/on_page/filters_and_thresholds/?bash\" rel=\"noopener noreferrer\" target=\"_blank\">此連結。</a>"
          },
          "search_after_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>後續請求的權杖</em><br>選填欄位<br>於每個請求回應的對應欄位中提供；<br>使用此參數可避免在單一請求中嘗試取得超過 <code>20,000</code> 筆結果時逾時；<br>透過指定回應陣列中的唯一 <code>search_after_token</code> 值，可取得初始任務的後續結果；<br><code>search_after_token</code> 值對每個後續任務都是唯一的；<br><strong>注意：</strong>若請求中指定了 <code>search_after_token</code>，其他所有參數都應與先前的請求完全相同"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>使用者自訂任務識別碼</em><br>選填欄位<br><em>字元數上限為 255</em><br>可使用此參數識別任務，並將其與結果對應<br>可在回應的 <code>data</code> 物件中找到指定的 <code>tag</code> 值"
          }
        },
        "example": [
          {
            "id": "07281559-0695-0216-0000-c269be8b7592",
            "page_from": "/apis/google-trends-api",
            "filters": [
              [
                "dofollow",
                "=",
                true
              ],
              "and",
              [
                "direction",
                "=",
                "external"
              ]
            ],
            "limit": 10
          }
        ]
      }
    ]
  },
  "example": [
    {
      "id": "07281559-0695-0216-0000-c269be8b7592",
      "page_from": "/apis/google-trends-api",
      "filters": [
        [
          "dofollow",
          "=",
          true
        ],
        "and",
        [
          "direction",
          "=",
          "external"
        ]
      ],
      "limit": 10
    }
  ]
}
```

## Responses

### 200 — 操作成功

Headers:
- `X-Request-Id` (string) — 聯絡 Felo 支援時需提供的請求識別碼。

**application/json**

Schema: object | null

```json
{
  "type": [
    "object",
    "null"
  ],
  "oneOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_OnPageLinksResponseInfo"
    }
  ]
}
```

### 400 — 無法處理該要求。請檢查請求參數。

### 401 — 需要有效的 Felo API 金鑰。

### 402 — 由於未符合計費要求，要求無法繼續。

### 403 — 該帳戶無權執行此操作。

### 429 — 已達到要求或支出上限。

### 502 — 服務無法完成該要求。

### 503 — API 或計費服務暫時無法使用。

### 504 — 服務在處理要求時逾時。

### default — 錯誤回應；上游透傳回應可能採用供應商格式

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_BaseOnPageLinkItem

`#/components/schemas/Response36Afe1097B20_BaseOnPageLinkItem`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "元素類型"
    },
    "domain_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>引薦網域</em><br>該連結是在此網域上找到的"
    },
    "domain_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>被引用網域</em><br>該連結指向此網域"
    },
    "page_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>引薦頁面</em><br>找到該連結的頁面的相對 URL"
    },
    "page_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>被引用頁面</em><br>該連結所指向頁面的相對 URL"
    },
    "link_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>引薦頁面</em><br>找到該連結的頁面的絕對 URL"
    },
    "link_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>被引用頁面</em><br>該連結所指向頁面的絕對 URL"
    },
    "dofollow": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "<em>表示連結是否為 dofollow</em><br>若值為 <code>true</code>，則該連結沒有 <code>rel=\"nofollow\"</code> 屬性"
    },
    "page_from_scheme": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>引薦頁面的 <a href=\"https://en.wikipedia.org/wiki/List_of_URI_schemes\" target=\"_blank\" rel=\"noopener noreferrer\">URL 配置</a></em>"
    },
    "page_to_scheme": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>被引用頁面的 <a href=\"https://en.wikipedia.org/wiki/List_of_URI_schemes\" target=\"_blank\" rel=\"noopener noreferrer\">URL 配置</a></em>"
    },
    "direction": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>連結方向</em><br>可能的值：<code>internal</code>、<code>external</code>"
    },
    "is_broken": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "<em>連結已失效</em><br>表示連結是否指向失效的頁面或資源"
    },
    "is_link_relation_conflict": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "<em>表示該連結可能與其他連結發生衝突</em><br>若為 <code>true</code>，則至少有一個指向 <code>link_to</code> 的連結具有 <code>rel=\"nofollow\"</code> 屬性，<strong>且</strong>至少有一個是 dofollow"
    },
    "page_to_status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>被引用頁面的狀態碼</em><br>該連結所指向頁面的狀態碼"
    }
  },
  "additionalProperties": false,
  "discriminator": {
    "propertyName": "type",
    "mapping": {
      "anchor": "#/components/schemas/Response36Afe1097B20_OnPageAnchorLinkItem",
      "image": "#/components/schemas/Response36Afe1097B20_OnPageImageLinkItem",
      "canonical": "#/components/schemas/Response36Afe1097B20_OnPageCanonicalLinkItem",
      "alternate": "#/components/schemas/Response36Afe1097B20_OnPageAlternateLinkItem",
      "link": "#/components/schemas/Response36Afe1097B20_OnPageLinkLinkItem",
      "redirect": "#/components/schemas/Response36Afe1097B20_OnPageRedirectLinkItem",
      "meta": "#/components/schemas/Response36Afe1097B20_OnPageMetaLinkItem"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseInfo`

```json
{
  "properties": {
    "version": {
      "type": [
        "string",
        "null"
      ],
      "description": "API 的目前版本"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "一般狀態碼\n完整回應碼清單請見此處"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "一般資訊訊息\n完整的一般資訊訊息清單請見此處"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "總執行時間，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任務總費用，美元",
      "format": "double"
    },
    "tasks_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 陣列中的任務數",
      "format": "int64"
    },
    "tasks_error": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 陣列中傳回錯誤的任務數",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseTaskInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo`

```json
{
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "任務識別碼\n我們系統中 UUID 格式的唯一任務識別碼"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "任務的狀態碼\n由 DataForSEO 產生，範圍如下：10000-60000\n完整回應碼清單請見此處"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "任務的資訊訊息\n完整的一般資訊訊息清單請見此處"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "執行時間，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任務總費用，美元",
      "format": "double"
    },
    "result_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "result 陣列中的元素數",
      "format": "int64"
    },
    "path": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "URL 路徑"
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "object",
          "null"
        ]
      },
      "description": "包含你在 POST 請求中指定的相同參數"
    }
  }
}
```

### Response36Afe1097B20_CrawlStatusInfo

`#/components/schemas/Response36Afe1097B20_CrawlStatusInfo`

```json
{
  "type": "object",
  "properties": {
    "max_crawl_pages": {
      "type": [
        "integer",
        "null"
      ],
      "description": "擷取頁面數上限\n 表示設定任務時指定的 max_crawl_pages 限制",
      "format": "int64"
    },
    "pages_in_queue": {
      "type": [
        "integer",
        "null"
      ],
      "description": "目前位於擷取佇列中的頁面數量",
      "format": "int64"
    },
    "pages_crawled": {
      "type": [
        "integer",
        "null"
      ],
      "description": "已擷取的頁面數量",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_OnPageLinksResponseInfo

`#/components/schemas/Response36Afe1097B20_OnPageLinksResponseInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseInfo"
    },
    {
      "type": "object",
      "properties": {
        "tasks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_OnPageLinksTaskInfo"
              }
            ]
          },
          "description": "<em>任務陣列</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_OnPageLinksResultInfo

`#/components/schemas/Response36Afe1097B20_OnPageLinksResultInfo`

```json
{
  "type": "object",
  "properties": {
    "crawl_progress": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>擷取工作階段的狀態</em><br>可能的值：<code>in_progress</code>、<code>finished</code>"
    },
    "crawl_status": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_CrawlStatusInfo"
        }
      ],
      "description": "<em>擷取工作階段的詳細資料</em>"
    },
    "search_after_token": {
      "type": [
        "string",
        "null"
      ]
    },
    "current_offset": {
      "type": [
        "integer",
        "null"
      ]
    },
    "total_items_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>資料庫中相關項目的總數</em>",
      "format": "int64"
    },
    "items_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>結果陣列中的項目數</em>",
      "format": "int64"
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_BaseOnPageLinkItem"
          }
        ]
      },
      "description": "<em>項目陣列</em>"
    }
  }
}
```

### Response36Afe1097B20_OnPageLinksTaskInfo

`#/components/schemas/Response36Afe1097B20_OnPageLinksTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_OnPageLinksResultInfo"
              }
            ]
          },
          "description": "<em>結果陣列</em>"
        }
      }
    }
  ]
}
```
