Contact Us
Back top
Current Location : APIs > 通用新闻资讯接口
通用新闻资讯接口 Transactions( 16577 )

通用新闻资讯接口

Intro. : Cover over 30 thousand worldwide news website and 100+ apps (include wechat, toutiao and so on)

Tag : 新闻 On Shelves Time : 2018-11-05

Type :

Tutorials

Total invocations(updated per hour)

通用新闻资讯接口 Free 辅助工具

API Mark

Example

Error Code
-- 请求示例 url 默认请求参数已经做URL编码 curl -i "/article/idataapi?kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000,1542499200&apikey=您的APIKEY&kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000%2C1542499200"
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; import java.io.PrintWriter; import java.net.URLConnection; public class Example { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); out.print(body); out.flush(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static void main(String[] args) throws IOException, JSONException { // 请求示例 url 默认请求参数已经做URL编码 String url = "/article/idataapi?kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000,1542499200&apikey=您的APIKEY&kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000%2C1542499200"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "/article/idataapi?kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000,1542499200&apikey=您的APIKEY&kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000%2C1542499200"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "/article/idataapi?kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000,1542499200&apikey=您的APIKEY&kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000%2C1542499200"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "/article/idataapi?kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000,1542499200&apikey=您的APIKEY&kw=&KwPosition=3&kwMode=3&sentiment=-1&publishDateRange=1541376000%2C1542499200" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
kw string 行业,调研,公司,基金,电子 查询关键词。逗号分割,搭配kwMode使用
kwMode string or and或者or
publishDateRange string 前闭后开,左边的时间戳不能超过30天,右边的时间戳不能超过当天23:59:59。不填默认查询当天数据
sentiment number 情感值 -1:负面 0:中立 1:正面
appCode string 逗号分割
sourceRegion string
sourceType string
pageToken string 翻页值
catLabel1 string
version string 目前可用版本包括: 0.1
KwPosition string 3 关键词匹配字段 1:标题, 2:正文 3:正文 + 标题 不填为3
catLabel2 string

Response Fields

Property Name Type Example Description
  • -
    data array [...] 数据
    • publishDate number 1542368700 公开数据
    • createDate number 1542297601 新增数据
    • id string 4e87cb4b75b417a76109fb26502af168 id
    • catLabel1 string 游戏 一级分类标签
    • topkeyword array [...] 文章内容top关键词
    • +
      sentimentDist object {...} content的情感分布
      • negative number 0.03349166304292 情感分布
      • positive number 0.96650833695708 情感分布
    • sourceType string 新闻网站 数据源类型
    • content string 终于等到有正赛玩的日子了,今天欧国联赛事,暂时看到我们这面的交易量还是相当可观的 文章内容
    • title string 文章正文 举报 标题
    • url string http://hao.win007.com/3083880/1711.html url
    • appCode string win007.com app代码
    • sourceRegion string 中国 数据源地区
    • +
      entities array [...] 命名实体
      • catName1 string 人名 名称
      • word string 欧国联 话题
  • total number 65141 总和
  • dataType string idata 数据类型
  • hasNext boolean true 是否有下一页
  • pageToken string WzE1NDIzNDgwMDAsMTU0MjI5NzYwMSwiZWFzdGRh 页面语言
  • retcode string 000000 再编码

Returns The Sample

{
    "data": [
        {
            "publishDate": 1542368700,
            "createDate": 1542297601,
            "id": "4e87cb4b75b417a76109fb26502af168",
            "catLabel1": "游戏",
            "topkeyword": [
                "威尔士",
                "比赛",
                "欧国联",
                "埃里克森",
                "指数",
                "发布",
                "作者",
                "回合",
                "体育",
                "平台"
            ],
            "sentimentDist": {
                "negative": 0.03349166304292,
                "positive": 0.96650833695708
            },
            "sourceType": "新闻网站",
            "content": "终于等到有正赛玩的日子了,今天欧国联赛事,暂时看到我们这面的交易量还是相当可观的,相信昨晚大家都等不是太猜的对,但今晚我可以跟你说,比昨天还难玩,欧国联是回血比赛,还是放血比赛?让我们一起看看\n加入球吧:【赢家计划】,获取更多临场动态,让我们共同见证辉煌的征途\n威尔士今天大名单有贝尔,拉姆塞等等,但盘口指数为平手,是对他们不支持还是减低赔付?丹麦首回合2:0搞掂对手,今天大名单也有首回合进球的中场大脑埃里克森压阵,实力不容忽视,但埃里克森已经在热刺很久都没比赛,加上他们如果打平的话,最后一轮对爱尔兰也不是好踢,所以我感觉上其实他们今天目标是一分,所以慢慢游戏指数开始对他们倾斜,这反而不是好事,我们行内话:暗热 加上有状态回归的大胜,丹麦的后防线今天都要经受一下考研 今天我看好主队威尔士能拿到分数\n推介:威尔士 平手盘\n特别声明:本文为球探体育平台“球探号”作者上传发布,仅代表该作者观点,球探体育仅提供发布平台。",
            "title": "文章正文 举报",
            "url": "http:\/\/hao.win007.com\/3083880\/1711.html",
            "appCode": "win007.com",
            "sourceRegion": "中国",
            "entities": [
                {
                    "catName1": "人名",
                    "word": "欧国联"
                },
                {
                    "catName1": "地名",
                    "word": "威尔士"
                },
                {
                    "catName1": "人名",
                    "word": "拉姆塞"
                },
                {
                    "catName1": "地名",
                    "word": "爱尔兰"
                },
                {
                    "catName1": "地名",
                    "word": "丹麦"
                },
                {
                    "catName1": "人名",
                    "word": "埃里克森"
                },
                {
                    "catName1": "人名",
                    "word": "贝尔"
                }
            ]
        }
    ],
    "total": 65141,
    "dataType": "idata",
    "hasNext": true,
    "pageToken": "WzE1NDIzNDgwMDAsMTU0MjI5NzYwMSwiZWFzdGRheS5jb20iLCI2ZmM2YzAxOGI3OGJkZDcxNjBkNjZjNjNkNGRkMzA2ZCJd",
    "retcode": "000000"
}

Detailed Data

No Details

状态码

Status Code Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}

The API in our platform is only paid when invoked successfully. For the detail, please refer to the below table.

Status Code Code Meaning Detailed Description Need paid or not?
000000 invoke successfully(data is not null) 成功调用并返回数据
100002 Search no result 目标参数搜索没结果
100301 Account not found 用户帐号不存在
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data