codecamp

内容安全检测

检测一段文本是否包含违法违规内容


接口地址

POST https://developer.toutiao.com/api/v2/tags/text/antidirt
⚠️ 注意
该接口请在开发者服务器端请求


输入

请求 Headers

名称描述
X-Token小程序 access_token,参考登录凭证检验


请求 Body

{
  "tasks": [
    {
      "content": "要检测的文本"
    }
  ]
}
名称描述
tasks检测任务列表
content检测的文本内容


输出

正确返回的 JSON 如下:

{
  "log_id": "2018112821375501001506902813132",
  "data": [
    {
      "code": 0,
      "task_id": "d0229abe-f312-11e8-966d-0242ac110009",
      "data_id": null,
      "cached": false,
      "predicts": [
        {
          "prob": 1,
          "model_name": "antidirt",
          "target": "default"
        }
      ],
      "msg": "ok"
    }
  ]
}
名称描述
log_id请求 id
data检测结果列表
code检测结果-状态码
msg检测结果- 消息
data_id检测结果-数据 id
task_id检测结果-任务 id
predicts检测结果-置信度列表
target检测结果-置信度-服务/目标
model_name检测结果-置信度-模型/标签
prob检测结果-置信度-概率,值为 0 或者 1,当值为 1 时表示检测的文本包含违法违规内容

当 access_token 检验失败时会返回如下信息:

{
  "error_id": "dd60b2bef95f40d7a4ace0bf5130d2e7",
  "code": 401,
  "message": "Authentication credentials were not provided.",
  "exception": "Authentication credentials were not provided."
}


authorize
图片检测
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题目录

无标题文章

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }