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
24 lines
848 B
JavaScript
24 lines
848 B
JavaScript
import { cli } from '@jackwener/opencli/registry';
|
|
import { AuthRequiredError } from '@jackwener/opencli/errors';
|
|
import { fetchXueqiuJson } from './utils.js';
|
|
cli({
|
|
site: 'xueqiu',
|
|
name: 'groups',
|
|
access: 'read',
|
|
description: '获取雪球自选股分组列表(含模拟组合)',
|
|
domain: 'xueqiu.com',
|
|
browser: true,
|
|
columns: ['pid', 'name', 'count'],
|
|
func: async (page, _kwargs) => {
|
|
await page.goto('https://xueqiu.com');
|
|
const d = await fetchXueqiuJson(page, 'https://stock.xueqiu.com/v5/stock/portfolio/list.json?category=1&size=20');
|
|
if (!d.data?.stocks)
|
|
throw new AuthRequiredError('xueqiu.com');
|
|
return (d.data.stocks || []).map((g) => ({
|
|
pid: String(g.id),
|
|
name: g.name,
|
|
count: g.symbol_count || 0,
|
|
}));
|
|
},
|
|
});
|