抖音域名检查API
接口概述
提供抖音域名拦截状态检查服务,支持批量检测多个域名是否被抖音平台拦截。该接口已集成API调用次数管理系统,需要使用API密钥进行身份验证。
接口地址
/api/douyin_check.php
请求方式
POST请求参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| username | string | 是 | 用户名 |
| api_key | string | 是 | API密钥 |
| urls | array | 是 | 要检查的URL数组,支持批量检查 |
| check_random | boolean | 否 | 是否同时检测随机二级域名,默认false |
参数传递方式
参数可通过以下方式传递(优先级从高到低):
1. HTTP Header(如
2. JSON Body (Content-Type: application/json)
3. POST Form (Content-Type: application/x-www-form-urlencoded)
4. GET Query String
1. HTTP Header(如
api_key: your_api_key)2. JSON Body (Content-Type: application/json)
3. POST Form (Content-Type: application/x-www-form-urlencoded)
4. GET Query String
请求示例
// JSON 请求示例 (application/json)
{
"username": "your_username",
"api_key": "your_api_key",
"urls": [
"https://www.baidu.com",
"https://www.example.com"
],
"check_random": true
}
// HTTP Header 请求示例(认证参数通过 Header 传递)
curl -X POST api/douyin_check.php \
-H "username: your_username" \
-H "api_key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"urls":["https://www.baidu.com"],"check_random":true}'
响应示例
成功响应(仅检测原始URL)
{
"code": 0,
"message": "success",
"data": {
"all_urls": [
{"url":"https://www.baidu.com", "type":"original"},
{"url":"https://www.example.com", "type":"original"}
],
"results": [
"未拦截",
"已拦截"
],
"remaining_credits": 98
}
}
成功响应(同时检测随机二级域名)
{
"code": 0,
"message": "success",
"data": {
"all_urls": [
{"url":"https://www.baidu.com", "type":"original"},
{"url":"https://www.example.com", "type":"original"},
{"url":"https://abc123.baidu.com", "type":"random"},
{"url":"https://def456.example.com", "type":"random"}
],
"results": [
"未拦截",
"已拦截",
"未拦截",
"已拦截"
],
"remaining_credits": 96
}
}
错误响应
{
"code": 1003,
"message": "用户名或API密钥无效"
}
错误码说明
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 1001 | 缺少必要参数 |
| 1002 | 参数验证失败 |
| 1003 | API密钥无效 |
| 1004 | 权限不足或API调用次数不足 |
| 1005 | 检测失败 |
| 5000 | 系统内部错误 |
结果说明
| 结果值 | 说明 |
|---|---|
| 未拦截 | 域名未被抖音拦截,可以正常在抖音中使用 |
| 已拦截 | 域名已被抖音拦截,无法在抖音中正常使用 |
| 无效URL | 提供的URL格式不正确 |
| 请求失败 | 网络请求失败,可能是网络问题或抖音跳转服务不可用 |
API次数管理
- 每个URL检查消耗1次API调用次数
- 当check_random为true时,每个原始URL及其对应的随机二级域名各消耗1次API调用次数
- 调用接口时会检查剩余次数,不足时会返回错误
- 响应中会包含剩余的API调用次数
调用示例
PHP示例
<?php
$username = "your_username";
$apiKey = "your_api_key";
$urls = [
"https://www.baidu.com",
"https://www.example.com"
];
$checkRandom = true;
$postData = json_encode([
"username" => $username,
"api_key" => $apiKey,
"urls" => $urls,
"check_random" => $checkRandom
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://your-domain/api/douyin_check.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
Python示例
import requests
import json
username = "your_username"
api_key = "your_api_key"
urls = [
"https://www.baidu.com",
"https://www.example.com"
]
check_random = True
url = "http://your-domain/api/douyin_check.php"
data = {
"username": username,
"api_key": api_key,
"urls": urls,
"check_random": check_random
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=json.dumps(data), headers=headers)
result = response.json()
print(result)