Xiaohongshu (RedNote) การค้นหาโน้ต API (V4)
ค้นหาโน้ตใน Xiaohongshu (RedNote) ผ่านกระบวนการค้นหาในแอปพลิเคชันมือถือ พร้อมการแบ่งหน้า การจัดเรียง ประเภทโน้ต และฟิลเตอร์เวลา ใช้เพื่อสนับสนุนการค้นหาหัวข้อซ้ำๆ และการค้นหาเนื้อหาที่มีการกรอง
สิ่งที่น่าสนใจ
คำแนะนำ
นี่คือเว็บ endpointสำหรับแอปพลิเคชันมือถือ. ผลการค้นหามีความแม่นยำมากขึ้น.
พารามิเตอร์
| ชื่อ | ตำแหน่ง | ชนิดข้อมูล | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|---|
token |
query | string |
ใช่ | - | โทเค็นการเข้าถึงสำหรับบริการ API นี้ |
keyword |
query | string |
ใช่ | - | คำสำคัญสำหรับการค้นหา. |
page |
query | integer |
ไม่ใช่ | 1 |
หมายเลขหน้าสำหรับการพับหน้า。 |
sortType |
query | string |
ไม่ใช่ | general |
ลำดับการจัดเรียงของชุดผลลัพธ์ ค่าที่มีอยู่: - general: ทั่วไป- popularity_descending: ตามลำดับความนิยม- time_descending: ตามลำดับเวลา- comment_descending: ตามลำดับความคิดเห็น- collect_descending: ตามลำดับการรวบรวม |
noteType |
query | string |
ไม่ใช่ | ALL |
ตัวกรองประเภทบันทึก ค่าที่มีอยู่: - ALL: ไม่มีข้อจำกัด- VIDEO_NOTE: บันทึกวิดีโอ- NORMAL_NOTE: บันทึกปกติ |
timeFilter |
query | string |
ไม่ใช่ | ALL |
ตัวกรองเวลาการเผยแพร่ ค่าที่มีอยู่: - ALL: ไม่มีข้อจำกัด- ONE_DAY: ภายในหนึ่งวัน- ONE_WEEK: ภายในหนึ่งสัปดาห์- HALF_YEAR: ภายในครึ่งปี |
ตัวอย่างโค้ด
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE'
ฉันต้องการใช้ API "การค้นหาโน้ต (V4)" จาก JustOneAPI.
URL หลัก: https://api.justoneapi.com.
เส้นทาง API: /api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE
เอนด์พอยต์ API: BASE_URL + /api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE
เมธอด HTTP: GET
การยืนยันตัวตน: เพิ่มพารามิเตอร์ "token" เข้าไปใน URL.
คำนิยาม OpenAPI: https://docs.justoneapi.com/openapi/xiaohongshu-rednote/note-search-v4-th.json
พารามิเตอร์:
- token (query): โทเค็นการเข้าถึงสำหรับบริการ API นี้ (จำเป็น)
- keyword (query): คำสำคัญสำหรับการค้นหา. (จำเป็น)
- page (query): หมายเลขหน้าสำหรับการพับหน้า。
- sortType (query): ลำดับการจัดเรียงของชุดผลลัพธ์
ค่าที่มีอยู่:
- `general`: ทั่วไป
- `popularity_descending`: ตามลำดับความนิยม
- `time_descending`: ตามลำดับเวลา
- `comment_descending`: ตามลำดับความคิดเห็น
- `collect_descending`: ตามลำดับการรวบรวม
- noteType (query): ตัวกรองประเภทบันทึก
ค่าที่มีอยู่:
- `ALL`: ไม่มีข้อจำกัด
- `VIDEO_NOTE`: บันทึกวิดีโอ
- `NORMAL_NOTE`: บันทึกปกติ
- timeFilter (query): ตัวกรองเวลาการเผยแพร่
ค่าที่มีอยู่:
- `ALL`: ไม่มีข้อจำกัด
- `ONE_DAY`: ภายในหนึ่งวัน
- `ONE_WEEK`: ภายในหนึ่งสัปดาห์
- `HALF_YEAR`: ภายในครึ่งปี
รูปแบบที่ส่งกลับ: จัดการ JSON หรือข้อความอย่างปลอดภัยตามค่า Content-Type ที่ได้รับจริง
การจัดการผลตอบกลับและรหัสข้อผิดพลาด:
1. ตรวจสอบผลการทำงานจากฟิลด์ "code" ในผลตอบกลับ (รหัส 0 หมายถึงสำเร็จ)
2. แนะนำให้ตั้งระยะเวลารอ 120 วินาที หาก 120 วินาทีนานเกินไป ให้ตั้งอย่างน้อย 60 วินาที แต่คำขอบางรายการอาจหมดเวลาก่อนได้รับผลลัพธ์
3. รหัสผลลัพธ์:
- 0: สำเร็จ
- 100: โทเคนไม่ถูกต้องหรือถูกปิดใช้งาน
- 301: ดึงข้อมูลไม่สำเร็จ โปรดลองอีกครั้ง
- 302: เกินขีดจำกัดอัตราการเรียก
- 303: ใช้โควตารายวันครบแล้ว
- 400: พารามิเตอร์ไม่ถูกต้อง
- 500: ข้อผิดพลาดภายในเซิร์ฟเวอร์
- 600: ไม่มีสิทธิ์เข้าถึง
- 601: ยอดเงินคงเหลือไม่เพียงพอ
- 602: ถึงวงเงินของโทเคนแล้ว
4. รหัส 601 หมายถึงยอดเงินที่ใช้ร่วมกันของบัญชีไม่เพียงพอ รหัส 602 หมายถึงโทเคน API ถึงวงเงินสะสมของตนเองแล้ว การกำหนดวงเงินโทเคนจะไม่โอนเงินออกจากยอดเงินที่ใช้ร่วมกันของบัญชี
กรุณาช่วยเขียนสคริปต์ในภาษาโปรแกรมที่ฉันชื่นชอบเพื่อเรียกใช้ API และจัดการการตอบกลับ.
import requests
BASE_URL = "https://api.justoneapi.com" # ให้โดยเซิร์ฟเวอร์ OpenAPI
url = BASE_URL + "/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")
const BASE_URL = "https://api.justoneapi.com"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
const url = BASE_URL + "/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
final String url = BASE_URL + "/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}
package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // ให้โดยเซิร์ฟเวอร์ OpenAPI
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}
<?php
$BASE_URL = 'https://api.justoneapi.com'; // ให้โดยเซิร์ฟเวอร์ OpenAPI
$url = $BASE_URL . '/api/xiaohongshu/search-note/v4?token=YOUR_API_KEY&keyword=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}
ฟิลด์ที่ได้รับการตอบกลับ
ฟิลด์สำคัญในผลการตอบกลับที่สำเร็จ (code = 0).
บทสรุปโดยรวม10 ฟิลด์
data.notes[]
ระบุผลลัพธ์ที่ส่งกลับสำหรับหน้าเว็บที่ขอมา
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
id |
string |
ID ของโน้ตจาก Xiaohongshu ที่ส่งกลับมาในรูปแบบสตริง |
title |
string |
ชื่อของโน้ตที่ปรากฏในการค้นหา อาจว่างเปล่า |
desc |
string |
คำอธิบายของโน้ตที่ปรากฏในการค้นหา |
type |
string |
ป้ายกำกับประเภทของโน้ต ค่าที่สังเกตได้คือปกติสำหรับโน้ตรูปภาพและข้อความ และสำหรับโน้ตวิดีโอคือวิดีโอ |
timestamp |
integer |
เวลาการเผยแพร่โน้ตในรูปแบบ Unix timestamp ในหน่วยวินาที |
last_update_time |
integer |
เวลาที่อัปเดตครั้งสุดท้ายในรูปแบบ Unix timestamp ในหน่วยวินาที หากเป็นบวก ฟิลด์นี้อาจมีค่าเป็นศูนย์ได้ |
has_music |
boolean |
โน้ตนั้นมีเสียงประกอบหรือไม่ |
tags |
array |
คำว่าแท็กที่ปรากฏสำหรับโน้ตนี้ อาจว่างเปล่า |
geo_info |
object |
ข้อมูลการแสดงตำแหน่งที่ปรากฏกับโน้ต |
geo_info.distance |
string |
ข้อความแสดงระยะทาง อาจว่างเปล่า |
ระดับความสนใจจากผู้ใช้6 ฟิลด์
data.notes[]
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
liked_count |
integer |
จำนวนความนิยมของโน็ตที่รายงานไว้。 |
comments_count |
integer |
จำนวนความคิดเห็นที่รายงานไว้สำหรับโน็ต。 |
collected_count |
integer |
จำนวนที่บันทึกไว้สำหรับโน็ต。 |
shared_count |
integer |
จำนวนครั้งที่โน้ตถูกแชร์ |
liked |
boolean |
โน้ตนั้นถูกแสดงว่าเป็นโน้ตที่ชื่นชอบในบริบทการดูขณะนี้หรือไม่ |
collected |
boolean |
โน้ตนั้นถูกแสดงว่าเป็นโน้ตที่ถูกบันทึกไว้ในบริบทการดูขณะนี้หรือไม่ |
ผู้เขียนโพสต์6 ฟิลด์
data.notes[].user
ข้อมูลผู้เขียนที่เปิดเผยมาพร้อมกับผลการค้นหาโน้ต
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
userid |
string |
ID ของผู้ใช้ Xiaohongshu ของผู้เขียนโน้ต ส่งกลับมาในรูปแบบสตริง |
red_id |
string |
ชื่อผู้ใช้ Xiaohongshu ที่เปิดเผยของผู้เขียนโน้ต |
nickname |
string |
ชื่อที่ปรากฏของผู้เขียนโน้ต |
images |
string |
URL ของรูปภาพโปรไฟล์ของผู้เขียนโน้ต |
red_official_verified |
boolean |
โน้ตนั้นแสดงว่าผู้เขียนได้รับการตรวจสอบอย่างเป็นทางการหรือไม่ |
followed |
boolean |
โน้ตนั้นแสดงว่าผู้เขียนถูกติดตามในบริบทการดูขณะนี้หรือไม่ |
รูปภาพและหน้าปก8 ฟิลด์
data.notes[].images_list[]
รายการรูปภาพสำหรับโน้ตนี้ รวมถึงรูปปกสำหรับโน้ตวิดีโอ
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
fileid |
string |
ตัวระบุที่ส่งกลับสำหรับไฟล์รูปภาพ |
height |
integer |
ความสูงของภาพในพิกเซล |
width |
integer |
ความกว้างของภาพในพิกเซล |
url |
string |
URL ของภาพในฟิลด์ URL มาตรฐาน ซึ่งอาจว่างเปล่า |
url_size_large |
string |
URL ของภาพสำหรับการดูภาพในรูปแบบที่ใหญ่ขึ้น |
original |
string |
URL ของภาพต้นฉบับ ซึ่งอาจว่างเปล่า |
need_load_original_image |
boolean |
ว่าภาพนั้นมีการระบุว่าต้องมีการโหลดเพิ่มเติมหรือไม่ |
live_photo_file_id |
string |
ตัวระบุไฟล์ที่เกี่ยวข้องกับ Live Photo หากมีให้ |
ภาพถ่ายสด35 ฟิลด์
data.notes[].images_list[].live_photo
ข้อมูลการเคลื่อนไหวของ Live Photo ที่เกี่ยวข้องกับภาพ หากมีให้
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
media |
object |
ข้อมูลสื่อการเคลื่อนไหวที่ส่งกลับมาสำหรับ Live Photo |
media.video_id |
integer |
ID ตัวเลขที่รายงานสำหรับสื่อการเคลื่อนไหวของ Live Photo |
media.video |
object |
ข้อมูลเมตาดาต้าของวิดีโอสำหรับคลิปการเคลื่อนไหวของ Live Photo |
media.video.width |
integer |
ความกว้างของเฟรมวิดีโอที่รายงานสำหรับคลิปการเคลื่อนไหว |
media.video.height |
integer |
ความสูงของเฟรมวิดีโอที่รายงานสำหรับคลิปการเคลื่อนไหว |
media.video.duration |
integer |
ค่าความยาวของวิดีโอที่รายงานสำหรับคลิปการเคลื่อนไหวของ Live Photo |
media.video.hdr_type |
integer |
ประเภท HDR ที่ตัวเลขรายงานสำหรับคลิปการเคลื่อนไหว |
media.video.drm_type |
integer |
ประเภท DRM ที่ตัวเลขรายงานสำหรับคลิปการเคลื่อนไหว |
media.stream |
object |
ตัวเลือกการเล่น Live Photo ที่จัดกลุ่มตามรูปแบบวิดีโอ |
media.stream.h264 |
array |
รายการที่ส่งกลับมาสำหรับตัวเลือก H.264 ซึ่งอาจว่างเปล่า |
media.stream.h265 |
array |
รายการตัวเลือก H.265 ที่ส่งกลับมาสำหรับ Live Photo |
media.stream.h265[] |
object |
ตัวเลือกการเล่น H.265 สำหรับ Live Photo |
media.stream.h265[].master_url |
string |
URL ของการเล่นหลักสำหรับสตรีม Live Photo นี้ |
media.stream.h265[].backup_urls |
array |
URL ของการเล่นสำรองสำหรับสตรีม Live Photo นี้ |
media.stream.h265[].backup_urls[] |
string |
URL ของการเล่นสำรองสำหรับสตรีมนี้หนึ่งตัว |
media.stream.h265[].width |
integer |
ความกว้างของเฟรมวิดีโอในพิกเซล |
media.stream.h265[].height |
integer |
ความสูงของเฟรมวิดีโอในพิกเซล |
media.stream.h265[].format |
string |
รูปแบบคอนเทนเนอร์สื่อที่รายงานสำหรับสตรีม |
media.stream.h265[].quality_type |
string |
ป้ายกำกับคุณภาพที่รายงานสำหรับสตรีมนี้ |
media.stream.h265[].stream_type |
integer |
ประเภทสตรีมที่เป็นตัวเลขที่รายงานสำหรับเวอร์ชันนี้ |
media.stream.h265[].stream_desc |
string |
คำอธิบายที่ให้ไว้สำหรับเวอร์ชันสตรีมนี้ |
media.stream.h265[].default_stream |
integer |
ตัวดำเนินการตัวเลขที่บ่งชี้สตรีมเริ่มต้น |
media.stream.h265[].fps |
integer |
อัตราการโหลดภาพวิดีโอที่รายงานสำหรับสตรีม |
media.stream.h265[].duration |
integer |
ค่าเวลาการสตรีมที่ Xiaohongshu รายงาน |
media.stream.h265[].video_duration |
integer |
ค่าความยาวของเทรนวิดีโอที่รายงานสำหรับสตรีม |
media.stream.h265[].audio_duration |
integer |
ค่าความยาวของเทรนเสียงที่รายงานสำหรับสตรีม |
media.stream.h265[].video_codec |
string |
ตัวระบุโปรโตคอลวิดีโอที่ส่งกลับสำหรับสตรีม |
media.stream.h265[].audio_codec |
string |
ตัวระบุโปรโตคอลเสียงที่ส่งกลับสำหรับสตรีม หากมีการระบุ |
media.stream.h265[].audio_channels |
integer |
จำนวนช่องเสียงที่รายงานสำหรับสตรีม |
media.stream.h265[].video_bitrate |
integer |
ค่าบิตเรตของวิดีโอที่รายงานสำหรับสตรีม |
media.stream.h265[].audio_bitrate |
integer |
ค่าบิตเรตของเสียงที่รายงานสำหรับสตรีม |
media.stream.h265[].avg_bitrate |
integer |
ค่าเฉลี่ยของบิตเรตที่รายงานสำหรับสตรีม |
media.stream.h265[].hdrType |
integer |
ประเภท HDR ที่เป็นตัวเลขที่รายงานสำหรับสตรีมนี้ |
media.stream.h266 |
array |
รายการที่ส่งกลับสำหรับเวอร์ชัน H.266 ซึ่งอาจว่างเปล่า |
media.stream.av1 |
array |
รายการที่ส่งกลับสำหรับเวอร์ชัน AV1 ซึ่งอาจว่างเปล่า |
การแสดงผลและการนับจำนวน8 ฟิลด์
data
หน้าหนึ่งของผลการค้นหาและสถิติการตอบกลับของ Xiaohongshu。
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
total |
integer |
จำนวนรายการผลลัพธ์ที่รายงานสำหรับการตอบกลับนี้ |
has_more |
boolean |
ว่าการตอบค้นหาแสดงว่ามีหน้าอื่นที่สามารถเข้าถึงได้หรือไม่ |
statistics |
object |
การแบ่งแยกจำนวนรายการที่รายงานสำหรับการตอบกลับนี้ |
statistics.total_items |
integer |
จำนวนรายการรวมที่รายงานในสถิติการตอบกลับ |
statistics.note_count |
integer |
จำนวนบันทึกปกติที่รายงานในสถิติการตอบกลับ |
statistics.video_count |
integer |
จำนวนบันทึกวิดีโอที่รายงานในสถิติการตอบกลับ |
statistics.ads_count |
integer |
จำนวนรายการโฆษณาที่รายงานในสถิติการตอบกลับ |
statistics.recommend_count |
integer |
จำนวนคำค้นหาที่แนะนำที่รายงานในสถิติการตอบกลับ |
ผลลัพธ์การค้นหาอื่นๆ5 ฟิลด์
data
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
ads |
array |
รายการโฆษณาที่ส่งกลับพร้อมหน้าผลลัพธ์ รายการอาจว่างเปล่า |
recommend_queries |
array |
คำค้นหาที่แนะนำที่ส่งกลับพร้อมหน้าผลลัพธ์ รายการอาจว่างเปล่า |
search_meta |
object |
ข้อมูลหน้าค้นหาที่ส่งกลับพร้อมผลลัพธ์ |
search_meta.is_broad_query |
boolean |
ว่าซิอ่าวหงชูจะจัดประเภทคำขอนี้เป็นประเภทกว้างหรือไม่ |
search_meta.show_single_col |
boolean |
ว่า�การตอบกลับจะแสดงผลลัพธ์ในรูปแบบคอลัมน์เดียวหรือไม่ |