小红书实况解析

小红书实况解析

解析小红书实况

GET JSON 总调用: 539 次
接口状态:正常

接口详情

GET
JSON

接口状态

调用频率 无限制
响应时间 测速中
稳定性 稳定

请求参数

参数名 是否必填 类型 说明 示例
url string 需要填的链接 http://xhslink.com/m/pTwtlevzMQ

示例代码

HTTP 请求
https://api.bugpk.com/api/xhslive?url=http://xhslink.com/m/pTwtlevzMQ
JavaScript 示例
// 使用 Fetch API 调用接口
const apiUrl = 'https://api.bugpk.com/api/xhslive';

// 准备请求参数
const params = {
    key1: 'value1',
    key2: 'value2',
    // 根据实际参数添加
};

// GET 请求示例
async function getRequest() {
    try {
        const queryParams = new URLSearchParams(params).toString();
        const url = `${apiUrl}?${queryParams}`;
        
        const response = await fetch(url, {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
            },
        });
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        console.log('响应数据:', data);
        return data;
    } catch (error) {
        console.error('请求失败:', error);
        throw error;
    }
}

// POST 请求示例
async function postRequest() {
    try {
        const response = await fetch(apiUrl, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(params),
        });
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        console.log('响应数据:', data);
        return data;
    } catch (error) {
        console.error('请求失败:', error);
        throw error;
    }
}

// 根据请求方法调用对应的函数
const method = 'GET';
if (method === 'GET') {
    getRequest();
} else if (method === 'POST') {
    postRequest();
}
PHP 示例
// 使用 cURL 调用接口
$apiUrl = 'https://api.bugpk.com/api/xhslive';
$method = 'GET';

// 准备请求参数
$params = [
    'key1' => 'value1',
    'key2' => 'value2',
    // 根据实际参数添加
];

function callApi($url, $method, $params = []) {
    $ch = curl_init();
    
    // 设置 cURL 选项
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    
    // 设置请求头
    $headers = [
        'Content-Type: application/json',
    ];
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    if ($method === 'GET') {
        // GET 请求
        $queryString = http_build_query($params);
        $fullUrl = $url . '?' . $queryString;
        curl_setopt($ch, CURLOPT_URL, $fullUrl);
    } else {
        // POST/PUT/DELETE 请求
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
        if (!empty($params)) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
        }
    }
    
    // 执行请求
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    
    if (curl_error($ch)) {
        throw new Exception('cURL Error: ' . curl_error($ch));
    }
    
    curl_close($ch);
    
    // 解析响应
    $data = json_decode($response, true);
    
    if (json_last_error() !== JSON_ERROR_NONE) {
        throw new Exception('JSON 解析错误: ' . json_last_error_msg());
    }
    
    return [
        'status' => $httpCode,
        'data' => $data
    ];
}

try {
    $result = callApi($apiUrl, $method, $params);
    echo "请求成功:\n";
    print_r($result['data']);
} catch (Exception $e) {
    echo "请求失败: " . $e->getMessage() . "\n";
}
Python 示例
import requests
import json

# API 配置
api_url = 'https://api.bugpk.com/api/xhslive'
method = 'get'

# 准备请求参数
params = {
    'key1': 'value1',
    'key2': 'value2',
    # 根据实际参数添加
}

# 设置请求头
headers = {
    'Content-Type': 'application/json',
    'User-Agent': 'API-Client/1.0'
}

def call_api():
    try:
        if method == 'get':
            # GET 请求
            response = requests.get(
                api_url,
                params=params,
                headers=headers,
                timeout=30
            )
        else:
            # POST/PUT/DELETE 请求
            data = json.dumps(params)
            if method == 'post':
                response = requests.post(api_url, data=data, headers=headers, timeout=30)
            elif method == 'put':
                response = requests.put(api_url, data=data, headers=headers, timeout=30)
            elif method == 'delete':
                response = requests.delete(api_url, data=data, headers=headers, timeout=30)
            else:
                raise ValueError(f"不支持的请求方法: {method}")
        
        # 检查响应状态
        response.raise_for_status()
        
        # 解析 JSON 响应
        result = response.json()
        
        print("请求成功!")
        print(f"状态码: {response.status_code}")
        print("响应数据:")
        print(json.dumps(result, indent=2, ensure_ascii=False))
        
        return result
        
    except requests.exceptions.RequestException as e:
        print(f"请求失败: {e}")
        return None
    except json.JSONDecodeError as e:
        print(f"JSON 解析失败: {e}")
        return None

# 调用接口
if __name__ == "__main__":
    result = call_api()
Java 示例
import java.io.*;
import java.net.*;
import java.util.HashMap;
import java.util.Map;

public class ApiClient {
    private static final String API_URL = "https://api.bugpk.com/api/xhslive";
    private static final String METHOD = "GET";
    
    public static void main(String[] args) {
        try {
            // 准备请求参数
            Map params = new HashMap<>();
            params.put("key1", "value1");
            params.put("key2", "value2");
            // 根据实际参数添加
            
            String response = callApi(API_URL, METHOD, params);
            System.out.println("响应结果: " + response);
        } catch (Exception e) {
            System.err.println("请求失败: " + e.getMessage());
        }
    }
    
    public static String callApi(String url, String method, Map params) throws IOException {
        HttpURLConnection connection = null;
        
        try {
            if (method.equals("GET")) {
                // GET 请求
                String queryString = buildQueryString(params);
                String fullUrl = url + "?" + queryString;
                
                URL apiUrl = new URL(fullUrl);
                connection = (HttpURLConnection) apiUrl.openConnection();
                connection.setRequestMethod("GET");
            } else {
                // POST/PUT/DELETE 请求
                URL apiUrl = new URL(url);
                connection = (HttpURLConnection) apiUrl.openConnection();
                connection.setRequestMethod(method);
                connection.setDoOutput(true);
                
                // 设置请求体
                String requestBody = buildJsonBody(params);
                try (OutputStream os = connection.getOutputStream()) {
                    byte[] input = requestBody.getBytes("utf-8");
                    os.write(input, 0, input.length);
                }
            }
            
            // 设置请求头
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("User-Agent", "API-Client/1.0");
            connection.setConnectTimeout(30000);
            connection.setReadTimeout(30000);
            
            // 获取响应
            int status = connection.getResponseCode();
            
            StringBuilder response = new StringBuilder();
            try (BufferedReader br = new BufferedReader(
                new InputStreamReader(connection.getInputStream(), "utf-8"))) {
                String responseLine;
                while ((responseLine = br.readLine()) != null) {
                    response.append(responseLine.trim());
                }
            }
            
            if (status != 200) {
                throw new IOException("HTTP 错误代码: " + status);
            }
            
            return response.toString();
            
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
    
    private static String buildQueryString(Map params) throws UnsupportedEncodingException {
        StringBuilder result = new StringBuilder();
        for (Map.Entry entry : params.entrySet()) {
            if (result.length() > 0) {
                result.append("&");
            }
            result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
            result.append("=");
            result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
        }
        return result.toString();
    }
    
    private static String buildJsonBody(Map params) {
        StringBuilder json = new StringBuilder();
        json.append("{");
        boolean first = true;
        for (Map.Entry entry : params.entrySet()) {
            if (!first) {
                json.append(",");
            }
            json.append("\"").append(entry.getKey()).append("\":\"").append(entry.getValue()).append("\"");
            first = false;
        }
        json.append("}");
        return json.toString();
    }
}
cURL 示例
# API 配置
API_URL="https://api.bugpk.com/api/xhslive"
METHOD="GET"

# GET 请求示例
curl -X GET \
  "$API_URL?key1=value1&key2=value2" \
  -H "Content-Type: application/json" \
  -H "User-Agent: API-Client/1.0"


# 带详细输出的 cURL 命令
curl -v \
  -X GET \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"key1":"value1","key2":"value2"}' \
  --connect-timeout 30 \
  --max-time 60

# 将响应保存到文件
curl -X GET \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -d '{"key1":"value1","key2":"value2"}' \
  -o response.json

# 使用变量参数的示例
KEY1="value1"
KEY2="value2"

curl -X GET \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -d "{\"key1\":\"$KEY1\",\"key2\":\"$KEY2\"}"

返回示例

JSON 响应
{
    "code": 200,
    "msg": "解析成功",
    "data": {
        "author": "意(原创素材供应)",
        "userId": "626b19680000000021023bff",
        "title": "88款氛围感高清实况图|原创未使用喜欢拿",
        "desc": "#实况照片[话题]# #live图[话题]# #实况[话题]# #live图比照片更有生命力[话题]# #live[话题]# #原创素材[话题]##素材分享[话题]##稀有素材[话题]# #高质素材[话题]# #爆款素材[话题]##实况素材[话题]# #氛围感素材[话题]# #emo素材[话题]#",
        "avatar": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31m64kbv7m6005ojb35k8cevvvq7erjg",
        "cover": "http://sns-webpic-qc.xhscdn.com/202509102331/234b53b9c466b0c3b86ab738a12d45e1/1040g00831m8etoch5m0g5ojb35k8cevvpg2mnog!nd_prv_wlteh_jpg_3",
        "type": "normal",
        "images": [
            "http://sns-webpic-qc.xhscdn.com/202509102331/25b5e5bd53b64405b2e78ed4fce6bac9/1040g00831m8etoch5m0g5ojb35k8cevvpg2mnog!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/d6b733e98683781db49f5045e6f2af0f/1040g00831m8es2aj582g5pqg2hhn3cr0622gk38!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/f01f6c85acb9bdd4af059c12394e09d7/1040g00831m8etoch5m2g5ojb35k8cevv21fe2b0!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/3926e3f24dd4bbf7fa1b14ba9522f660/1040g00831m8es2aj58305pqg2hhn3cr0segd1bo!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/7953d7dda1aabcfee8619b5ea33bdff3/1040g00831m8es2aj583g5pqg2hhn3cr09m0qsf0!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/96afecae6c1be5ed90fd19ef3c51d0a5/1040g00831m8es2aj58405pqg2hhn3cr01oi6uo0!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/d2516f5492257d964e00e3ad65d50b57/1040g00831m8es2aj584g5pqg2hhn3cr0dppjp5g!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/98407e1da006acd4bb58455b3a62a1e5/1040g00831m8es2aj58205pqg2hhn3cr075u2eco!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/f07372c5542483026242b26977e6d4e7/1040g00831m8es2aj585g5pqg2hhn3cr09oco1dg!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/e7be5fb5d0a7613983a2e4df2094f488/1040g00831m8etoch5m005ojb35k8cevv62ttb88!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/260b964af3c31ea38a69905d1728f1e2/1040g00831m8es2aj58505pqg2hhn3cr0qva10lo!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/98481888279fba99e6f8e386ab3ba4b4/1040g00831m8etoch5m105ojb35k8cevvdt3lsqo!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/87fb303154f08c35d7b3791fbe8146b5/1040g00831m8etoch5m205ojb35k8cevv6l66dtg!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/d2d961f14c840b46e8de420ebd119ac5/1040g00831m8es2aj586g5pqg2hhn3cr0cs9cd30!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/c6bce5574bea86fdd3ea5ec88af305ee/1040g00831m8etoch5m305ojb35k8cevv41i0r38!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/28b3d9deabd3160d6eb341b4a00685dc/1040g00831m8etoch5m1g5ojb35k8cevv5tthcho!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/21e3fc30907dca0775101dd930a32814/1040g00831m8es2aj58605pqg2hhn3cr0ki083f0!nd_dft_wlteh_jpg_3",
            "http://sns-webpic-qc.xhscdn.com/202509102331/6a81e974a5afddda27638e79ebcd8905/1040g00831m8etoch5m3g5ojb35k8cevvm1oqbg8!nd_dft_wlteh_jpg_3"
        ],
        "url": [
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cf0072ca2010050039933166f71_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d5fbdec23010050039933167144_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cf507e5dc0100500399331677ab_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cf607e9ad0100500399331673d3_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cf807ede6010050039933166dd7_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cfb070645010050039933168082_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14cfe07fb550100500399331666e1_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d0007135801005003993316708c_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d5fbe8731010050039933166999_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d0507cc5e01005003993316657d_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d14070630010050039933166f19_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d1507f67e010050039933166d6c_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d1807fd7a0100500399331678da_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d1b07167c010050039933166bf1_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d1d07cabf010050039933167774_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d200724b0010050039933167a9d_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d5fbe8732010050039933168819_19.mp4",
            "http://sns-video-alos.xhscdn.com/stream/1/10/19/01e8c14d2507df23010050039933166958_19.mp4"
        ]
    }
}

响应参数

参数名 类型 说明 示例
code string 状态码
msg string 结果信息

在线请求

该接口仅支持 GET 请求

响应结果
发送请求后,响应结果将显示在这里...