/ clis / nowcoder / hot.js
hot.js
 1  import { cli, Strategy } from '@jackwener/opencli/registry';
 2  
 3  cli({
 4      site: 'nowcoder',
 5      name: 'hot',
 6      description: 'Hot search ranking',
 7      domain: 'www.nowcoder.com',
 8      strategy: Strategy.PUBLIC,
 9      browser: false,
10      args: [
11          { name: 'limit', type: 'int', default: 10, help: 'Number of items' },
12      ],
13      columns: ['rank', 'title', 'heat'],
14      pipeline: [
15          { fetch: { url: 'https://gw-c.nowcoder.com/api/sparta/hot-search/hot-content' } },
16          { select: 'data.hotQuery' },
17          { map: {
18                  rank: '${{ item.rank }}',
19                  title: '${{ item.query }}',
20                  heat: '${{ item.hotValue }}',
21              } },
22          { limit: '${{ args.limit }}' },
23      ],
24  });