n8n-nodes-xiaohongshu
Version:
n8n node for Xiaohongshu (Little Red Book) API integration
77 lines (76 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.XiaohongshuCookieApi = void 0;
class XiaohongshuCookieApi {
constructor() {
this.name = 'xiaohongshuCookieApi';
this.displayName = '小红书 Cookie API';
this.documentationUrl = 'https://www.xiaohongshu.com';
this.properties = [
{
displayName: 'Cookie',
name: 'cookie',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
description: '小红书网站的完整 Cookie 字符串,包含 a1、web_session 等必要字段',
placeholder: 'a1=xxx; web_session=xxx; abRequestId=xxx; ...',
},
{
displayName: '用户代理',
name: 'userAgent',
type: 'string',
default: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
description: '浏览器用户代理字符串,建议使用与获取 Cookie 时相同的浏览器',
},
{
displayName: '签名服务 URL',
name: 'signServiceUrl',
type: 'string',
default: '',
required: true,
description: '小红书API签名服务的完整接口URL',
placeholder: 'https://your-sign-service.com/v1/xhs/web/get_sign_params',
},
{
displayName: '签名服务 Token(可选)',
name: 'signServiceToken',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: false,
description: '访问签名服务所需的API Token(可选,如果签名服务不需要认证可留空)',
placeholder: '如不需要认证请留空',
},
];
this.authenticate = {
type: 'generic',
properties: {
headers: {
Cookie: '={{$credentials.cookie}}',
'User-Agent': '={{$credentials.userAgent}}',
},
},
};
this.test = {
request: {
url: '={{$credentials.signServiceUrl}}',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: {
uri: '/api/sns/web/v1/search/notes',
data: {},
cookies: '={{$credentials.cookie}}',
},
},
};
}
}
exports.XiaohongshuCookieApi = XiaohongshuCookieApi;