新闻头条
提供新闻头条信息查询,实时获取时政、财经、科技等多领域头条资讯,支持分类筛选等方式检索,助力应用快速集成权威新闻内容
套餐
普通会员
100次/天
VIP会员
月:5000次/天
高级VIP
月:11000次/天
钻石VIP
月:14000次/天

https://api.slsj.com/api/ref/news
{
  "code": 0,
  "msg": "操作成功",
  "result": {
    "createTime": "2025-06-18 16:59:12",
    "data": [
      {
        "authorName": "中国网",
        "category": "头条",
        "date": "2025-06-13T15:16",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613151617_509ff7905a33c7748aab72f44a1a16e0_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "徐州睢宁县:老科学家走进校园,助力学生追逐“星辰大海”",
        "uniquekey": "5e98f5dae46491fd115b6f99b6269ab3",
        "url": "https://mini.eastday.com/mobile/250613151617658476407.html"
      },
      {
        "authorName": "当代先锋网",
        "category": "头条",
        "date": "2025-06-13T15:15",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613151555_ee772c752bbf5092e73809d62f3a67d3_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "“环山趣驾”为乡村振兴注入新活力",
        "uniquekey": "935412630fd3852c262f2a81c82b3fb0",
        "url": "https://mini.eastday.com/mobile/250613151555153269405.html"
      },
      {
        "authorName": "海外网",
        "category": "头条",
        "date": "2025-06-13T15:13",
        "isContent": 1,
        "thumbnailPicS": "",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "2025年第二趟“京和号”旅游专列启程",
        "uniquekey": "8c2b8d6f0d787838cdce0c9e35cd9735",
        "url": "https://mini.eastday.com/mobile/250613151345442130462.html"
      },
      {
        "authorName": "北青网",
        "category": "头条",
        "date": "2025-06-13T15:12",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613151206_8e4526b2caa0484d80369082a31bfced_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "2025年大兴区正式启动面向毕业大学生对接保障性租赁住房配租工作",
        "uniquekey": "52ec44cdb43a132e6996a139c5997a88",
        "url": "https://mini.eastday.com/mobile/250613151206873913715.html"
      },
      {
        "authorName": "中国消费者报•中国消费网",
        "category": "头条",
        "date": "2025-06-13T15:10",
        "isContent": 1,
        "thumbnailPicS": "",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "手机换膜引纠纷 市场监管部门助调解",
        "uniquekey": "425a380b68d8d5a71376953948cd9b7f",
        "url": "https://mini.eastday.com/mobile/250613151052348544013.html"
      },
      {
        "authorName": "鲁网",
        "category": "头条",
        "date": "2025-06-13T14:55",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613145510_9bda760168c044a980530a9db5b63c1f_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "烟台毓璜顶医院互联网医院升级AI导诊、预问诊平台开启智慧就医新体验",
        "uniquekey": "311344c2315e8aded9af5ce9c3f3ba45",
        "url": "https://mini.eastday.com/mobile/250613145510743438397.html"
      },
      {
        "authorName": "鲁网",
        "category": "头条",
        "date": "2025-06-13T14:54",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613145436_c3d197516b21ed8031003393b62c4037_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "农行临沂兰山支行营业部:温情服务显担当 守护老人暖人心",
        "uniquekey": "4bb7591751feda0096d85baae4cf1d3c",
        "url": "https://mini.eastday.com/mobile/250613145436938759862.html"
      },
      {
        "authorName": "大皖新闻",
        "category": "头条",
        "date": "2025-06-13T14:52",
        "isContent": 1,
        "thumbnailPicS": "",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "湖南慈利县有溶洞垃圾被黄土掩埋?镇政府:确有此事,但事发地并非溶洞",
        "uniquekey": "e70ed8626e2e14b4fa6273a629f2f4da",
        "url": "https://mini.eastday.com/mobile/250613145205256935803.html"
      },
      {
        "authorName": "北青网",
        "category": "头条",
        "date": "2025-06-13T14:41",
        "isContent": 1,
        "thumbnailPicS": "https://dfzximg02.dfxwdc.com/news/20250613/20250613144132_ffb177f64acb2748fa35a2434100dbe7_1_mwpm_03201609.jpeg",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "“我们走向世界——全球数字发行甄选音乐会”在中央音乐学院附中举办",
        "uniquekey": "051ce92ed6605f72215620285273ab45",
        "url": "https://mini.eastday.com/mobile/250613144132761130031.html"
      },
      {
        "authorName": "鲁网",
        "category": "头条",
        "date": "2025-06-13T14:21",
        "isContent": 1,
        "thumbnailPicS": "",
        "thumbnailPicS02": "",
        "thumbnailPicS03": "",
        "title": "农行临沂市中支行专业耐心服务获客户两个表扬工单",
        "uniquekey": "c9c9e624149a35b659d5552c14e9f18e",
        "url": "https://mini.eastday.com/mobile/250613142112593470182.html"
      }
    ],
    "orderId": "20250618165910959",
    "orderNumber": "512025061800000000541056",
    "pageNum": 1,
    "pageSize": 10,
    "total": "1532"
  }
}{
    "code": 400,
    "msg": "业务处理失败,请稍侯重试",
    "result": null
}package com.example.api.V106;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import static org.junit.jupiter.api.Assertions.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.*;
import java.util.stream.Collectors;
import java.util.Base64;
public class ApiTest1050 {
    // 签名相关的常量
    private static final String SIGN_KEY = "XXXXXX"; // 替换为实际的签名密钥
    private static final String USER_ID = "XXXXXXX"; // 替换为实际的用户编号
    public static void main(String[] args) throws Exception {
        String apiUrl = "https://api.slsj.com/api/ref/news";
        String orderId = "1050001";
        String pageNum = "1";
        String pageSize = "10";
        String type = "1";
    
        // 准备请求参数
        Map<String, Object> params = new HashMap<>();
        params.put("orderId", orderId);
        params.put("pageNum", pageNum);
        params.put("pageSize", pageSize);
        params.put("type", type);
        testVerification(apiUrl, params);
    }
    // 获取Auth_Token的方法
    private static String getAuthToken() throws Exception {
        // 获取当前时间戳
        long timestamp = System.currentTimeMillis();
        // 按照文档拼接待加密字符串
        String toEncrypt = "memberId=" + USER_ID + "dateTime=" + timestamp + "version=v1" + "key=" + SIGN_KEY;
        // MD5加密
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] digest = md.digest(toEncrypt.getBytes(StandardCharsets.UTF_8));
        String md5Result = bytesToHex(digest).toLowerCase();
        // 创建鉴权Token的JSON对象
        JSONObject authTokenObj = new JSONObject();
        authTokenObj.set("memberId", USER_ID);
        authTokenObj.set("dateTime", timestamp);
        authTokenObj.set("version", "v1");
        authTokenObj.set("signMd5", md5Result);
        
        String authToken = authTokenObj.toString();
        return authToken;
    }
    // 辅助方法:将字节数组转换为十六进制字符串
    private static String bytesToHex(byte[] bytes) {
        StringBuilder result = new StringBuilder();
        for (byte b : bytes) {
            result.append(String.format("%02x", b));
        }
        return result.toString();
    }
    public static void testVerification(String apiUrl,Map<String, Object> params) throws Exception {
        
        // 获取鉴权Token
        String authToken = getAuthToken();
        
        // 发送请求
        HttpResponse response = HttpRequest.post(apiUrl)
            .header("Content-Type", "application/x-www-form-urlencoded")
            .header("Auth_Token", authToken)
            .header("Sign_Type", "md5")
            .form(params)
            .execute();
        
        // 输出响应结果
        int status = response.getStatus();
        String responseBody = response.body();
        
        System.out.println("响应状态码: " + status);
        System.out.println("响应内容: " + responseBody);
        
        // 验证响应码
        assertEquals(HttpURLConnection.HTTP_OK, status, "Response code should be 200");
        
        // 解析响应内容(假设响应是JSON格式)
        // JSONObject responseJson = JSONUtil.parseObj(responseBody);
    }
} 代码信息添加中...import hashlib
import json
import time
import requests
# 用户ID和密钥
user_id = "xxxxxx"  # 替换为实际的用户编号
signature_key = "xxxxxxxxxxxxxxx"   # 替换为实际的签名密钥
# 版本号
version = "v1"
# 生成加密签名
def generate_auth_token():
    query_time = int(time.time() * 1000)
    original_string = f'memberId={user_id}dateTime={query_time}version={version}key={signature_key}'
    md5_result = hashlib.md5(original_string.encode('utf-8')).hexdigest()
    auth_token = {
        "memberId": user_id,
        "dateTime": query_time,
        "version": version,
        "signMd5": md5_result
    }
    return auth_token
# 请求接口并打印响应结果
request_url = 'https://api.slsj.com/api/ref/news'
params = {
    "orderId": "20250416094659001",
    "type": 1,
    "pageNum": 1,
    "pageSize": 10
}
headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Auth_Token': json.dumps(generate_auth_token()),
           'Sign_Type': 'md5'}
response = requests.post(headers=headers, url=request_url, data=params)
if response.status_code == 200:
    print(response.json())
else:
    print(response.text)
代码信息添加中...新闻头条
ID:647
申请次数
18
收藏次数
25
认证要求
场景审核
联系电话:
400-000-6665
联系邮箱:
suilian@suiliantech.com
在线客服:
