9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
import { COLLECT_API_PATTERN, fetchXhsCollectionNotes, parseCollectionLimit, resolveXhsUserId, SAVED_PROFILE_TAB } from './collection-helpers.js';
|
|
|
|
cli({
|
|
site: 'xiaohongshu',
|
|
name: 'saved',
|
|
access: 'read',
|
|
description: '小红书收藏笔记列表',
|
|
domain: 'www.xiaohongshu.com',
|
|
strategy: Strategy.COOKIE,
|
|
navigateBefore: false,
|
|
browser: true,
|
|
args: [
|
|
{ name: 'id', type: 'string', help: 'User id or profile URL (defaults to current logged-in user)' },
|
|
{ name: 'limit', type: 'int', default: 20, help: 'Number of notes to return' },
|
|
],
|
|
columns: ['rank', 'id', 'title', 'author', 'likes', 'type', 'url'],
|
|
func: async (page, kwargs) => {
|
|
const limit = parseCollectionLimit(kwargs.limit);
|
|
const userId = await resolveXhsUserId(page, kwargs.id);
|
|
return fetchXhsCollectionNotes(page, {
|
|
userId,
|
|
profileTab: SAVED_PROFILE_TAB,
|
|
apiPattern: COLLECT_API_PATTERN,
|
|
limit,
|
|
emptyLabel: 'saved',
|
|
});
|
|
},
|
|
});
|