关键词抽取API接口

通过词频算法抽取文本中的关键词,适用于诸如新闻内容关键词自动提取、评论关键词提取、网站SEO优化、网站内部搜索引擎关键字提取等场景。

接口文档 《查看会员》
接口地址: http://api.toolfk.com/api/keyword
请求方法: [ "GET", "POST" ]
请求参数:
名称类型描述示例
tokenstring请求的token用户中心获取token
contentstring 内容 未来世界,地球因环境污染而千疮百孔,人类家园破败萧条。一颗陨石突然撞击地球,并带来杀伤力极强的外星生物,560万人将因此失去生命。
limitstring 返回关键词个数 10
-- 漂亮的分割符 --
返回数据:

{
    "status": 1,
    "data": "地球 560 外星 千疮百孔 破败 陨石 杀伤力 极强 家园 环境污染"
}
                
                            
代码示例:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
  • Nodejs

    curl -X POST \
    http://api.toolfk.com/api/keyword \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10'
                                       
//记得去掉这个 "\" 斜线
<\?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.toolfk.com/api/keyword",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
   

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10");
Request request = new Request.Builder()
  .url("http://api.toolfk.com/api/keyword")
  .post(body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();


                                       
import requests

url = "http://api.toolfk.com/api/keyword"

payload = "token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10"
headers = {'Content-Type': "application/x-www-form-urlencoded"}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var data = "token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        console.log(this.responseText);
    }
});

xhr.open("POST", "http://api.toolfk.com/api/keyword");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.send(data);
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/keyword"

	payload := strings.NewReader("token=用户中心获取&content=%E6%9C%AA%E6%9D%A5%E4%B8%96%E7%95%8C%EF%BC%8C%E5%9C%B0%E7%90%83%E5%9B%A0%E7%8E%AF%E5%A2%83%E6%B1%A1%E6%9F%93%E8%80%8C%E5%8D%83%E7%96%AE%E7%99%BE%E5%AD%94%EF%BC%8C%E4%BA%BA%E7%B1%BB%E5%AE%B6%E5%9B%AD%E7%A0%B4%E8%B4%A5%E8%90%A7%E6%9D%A1%E3%80%82%E4%B8%80%E9%A2%97%E9%99%A8%E7%9F%B3%E7%AA%81%E7%84%B6%E6%92%9E%E5%87%BB%E5%9C%B0%E7%90%83%EF%BC%8C%E5%B9%B6%E5%B8%A6%E6%9D%A5%E6%9D%80%E4%BC%A4%E5%8A%9B%E6%9E%81%E5%BC%BA%E7%9A%84%E5%A4%96%E6%98%9F%E7%94%9F%E7%89%A9%EF%BC%8C560%E4%B8%87%E4%BA%BA%E5%B0%86%E5%9B%A0%E6%AD%A4%E5%A4%B1%E5%8E%BB%E7%94%9F%E5%91%BD%E3%80%82&limit=10")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer_no res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/keyword"

        payload := strings.NewReader("{
          "token": "用户中心获取token",
          "type": "a",
          "format": "json"
        }")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer_no res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
返回状态码 status 描述参照
返回码描述
status1:表示成功,0:表示失败
data成功返回数据
errmsg失败返回数据
备注:开通API接口服务,可同时享用 www.toolfk.com 网站的会员工具。