This commit is contained in:
2025-05-05 00:01:36 +08:00
parent d6014b3c40
commit a412c09da0
20 changed files with 2911 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
import { xhsServices } from '../index.ts';
import { xhsServices, app } from '../index.ts';
import { program } from 'commander';
export { program, xhsServices };
export { program, xhsServices, app };

View File

@@ -7,8 +7,30 @@ program
const client = xhsServices.getClient();
const res = await client.postComment({
note_id: '68136dab0000000007034c46',
content: 'test comment 233',
comment_id: '68136dcf000000000401a8c9',
content: 'test',
comment_id: '681741610000000004014e77',
// images_info: {
// images: [
// {
// file_id: '1040g2h031h28ues73i405ostgpcpgo3mff4lk68',
// metadata: { source: -1 },
// stickers: { version: 2, floating: [] },
// extra_info_json: '{"mimeType":"image/jpeg"}',
// },
// ],
// },
images: ['http://sns-img-qc.xhscdn.com/comment/1040g2h031h28ues73i405ostgpcpgo3mff4lk68']
});
console.log(res);
});
// http://sns-img-qc.xhscdn.com/comment/1040g2h031h28ues73i405ostgpcpgo3mff4lk68
const item_info = {
type: 'note_info',
id: '68136dab0000000007034c46',
image: 'http://ci.xiaohongshu.com/notes_pre_post/1040g3k031gulc4mn3q505pp6prq734o3hmigh70?imageView2/2/w/1080/format/jpg',
image_info: {
url: 'http://ci.xiaohongshu.com/notes_pre_post/1040g3k031gulc4mn3q505pp6prq734o3hmigh70?imageView2/2/w/1080/format/jpg',
width: 1200,
height: 1600,
},
};

View File

@@ -1,10 +1,12 @@
import { xhsServices, program } from '../common.ts';
import { xhsServices, program, app } from '../common.ts';
import util from 'node:util';
import { omit } from 'lodash-es';
const getMentions = async () => {
try {
const client = xhsServices.getClient();
const res = await client.getMention(1);
if (res.code) {
if (res.code === 0) {
const data = res.data || {};
console.log('getMentionNotifications', util.inspect(data, { depth: 10 }));
}
@@ -27,3 +29,20 @@ const getTestMentionNote = async () => {
};
program.command('test-mention').description('get mention note').action(getTestMentionNote);
const queryMention = async () => {
const res = await app.call({
path: 'mention',
key: 'getMention',
payload: {
num: 1,
},
});
if (res.code === 200) {
let data = res.body || [];
// data = data.map((item) => omit(item, 'mention'));
console.log('queryMention', util.inspect(data, { depth: 10 }));
}
};
program.command('query-mention').description('query mention').action(queryMention);