red-note-api
Version:
Parse the Xiaohongshu API
29 lines (28 loc) • 1.56 kB
TypeScript
import qs from 'query-string';
export default class RedNoteClient {
private readonly _host;
private readonly _creatorHost;
private readonly _customerHost;
private readonly axiosInstance;
private readonly timeout?;
private readonly userAgent?;
constructor(cookie?: string, userAgent?: string, timeout?: number);
set cookie(cookie: string);
get cookie(): string;
get cookieDict(): qs.ParsedQuery<string>;
_preHeaders(url: string, data?: any): void;
request(method: 'GET' | 'POST', url: string, config?: any): Promise<any>;
get(uri: string, params?: any, isCreator?: boolean, isCustomer?: boolean, config?: any): Promise<any>;
post(uri: string, data?: any, isCreator?: boolean, isCustomer?: boolean, config?: {
headers?: any;
}): Promise<any>;
getNoteById(noteId: string, image_scenes?: string[]): Promise<any>;
getSelfInfo(): Promise<any>;
searchUser(keyword: string, page?: number, page_size?: number): Promise<any>;
searchNotes(keyword: string, page?: number, page_size?: number, sort?: string, note_type?: number, // 0 = All, 1 = Video, 2 = Image
ext_flags?: never[], image_formats?: string[]): Promise<any>;
getUserInfo(userId: string): Promise<any>;
getNoteListByUserId(num: number | undefined, cursor: string | undefined, user_id: string, image_scenes?: string): Promise<any>;
postComment(note_id: string, content: string, target_comment_id?: string, at_users?: string[]): Promise<any>;
deleteComment(note_id: string, comment_id: string): Promise<any>;
}