feed.js
1 import { cli, Strategy } from '@jackwener/opencli/registry'; 2 import { buildSubstackBrowseUrl, loadSubstackFeed } from './utils.js'; 3 cli({ 4 site: 'substack', 5 name: 'feed', 6 description: 'Substack 热门文章 Feed', 7 domain: 'substack.com', 8 strategy: Strategy.COOKIE, 9 args: [ 10 { name: 'category', default: 'all', help: '文章分类: all, tech, business, culture, politics, science, health' }, 11 { name: 'limit', type: 'int', default: 20, help: '返回的文章数量' }, 12 ], 13 columns: ['rank', 'title', 'author', 'date', 'readTime', 'url'], 14 func: async (page, args) => loadSubstackFeed(page, buildSubstackBrowseUrl(args.category), Number(args.limit) || 20), 15 });