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
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
/**
|
|
* Build the notifications pipeline for the given web host. Exported so the
|
|
* rednote adapter can register the same pipeline against www.rednote.com.
|
|
*/
|
|
export function buildNotificationsPipeline(webHost) {
|
|
return [
|
|
{ navigate: `https://${webHost}/notification` },
|
|
{ tap: {
|
|
store: 'notification',
|
|
action: 'getNotification',
|
|
args: [`\${{ args.type | default('mentions') }}`],
|
|
capture: '/you/',
|
|
select: 'data.message_list',
|
|
timeout: 8,
|
|
} },
|
|
{ map: {
|
|
rank: '${{ index + 1 }}',
|
|
user: '${{ item.user_info.nickname }}',
|
|
action: '${{ item.title }}',
|
|
content: '${{ item.comment_info.content }}',
|
|
note: '${{ item.item_info.content }}',
|
|
time: '${{ item.time }}',
|
|
} },
|
|
{ limit: '${{ args.limit | default(20) }}' },
|
|
];
|
|
}
|
|
export const command = cli({
|
|
site: 'xiaohongshu',
|
|
name: 'notifications',
|
|
access: 'read',
|
|
description: '小红书通知 (mentions/likes/connections)',
|
|
domain: 'www.xiaohongshu.com',
|
|
strategy: Strategy.INTERCEPT,
|
|
browser: true,
|
|
args: [
|
|
{
|
|
name: 'type',
|
|
default: 'mentions',
|
|
help: 'Notification type: mentions, likes, or connections',
|
|
},
|
|
{ name: 'limit', type: 'int', default: 20, help: 'Number of notifications to return' },
|
|
],
|
|
columns: ['rank', 'user', 'action', 'content', 'note', 'time'],
|
|
pipeline: buildNotificationsPipeline('www.xiaohongshu.com'),
|
|
});
|