Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions clis/aibase/news.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* aibase news adapter
*
* Fetches the latest AI industry daily news from AIbase (日报).
* Scrapes article links from aibase.com/zh/daily.
*
* Usage:
* opencli aibase news
* opencli aibase news --limit 10
*/
import { cli, Strategy } from '@jackwener/opencli/registry';

cli({
site: 'aibase',
name: 'news',
description: 'AIbase 日报 - 每天三分钟关注AI行业趋势',
domain: 'www.aibase.com',
strategy: Strategy.PUBLIC,
browser: true,
args: [
{ name: 'limit', type: 'int', default: 20, help: 'Number of news items to return' },
],
columns: ['rank', 'title', 'url'],
pipeline: [
{ navigate: 'https://www.aibase.com/zh/daily' },
{
evaluate: `
const items = Array.from(
document.querySelectorAll('.bg-white .grid a')
).filter(el => el.href && el.textContent.trim());
return items.map((el, i) => ({
rank: i + 1,
title: el.textContent.trim(),
url: el.href,
}));
`,
},
{ limit: '${{ args.limit }}' },
],
});
43 changes: 43 additions & 0 deletions clis/uisdc/news.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* uisdc news adapter
*
* Fetches the latest AI/design industry news from 优设读报 (uisdc.com/news).
* Uses browser scraping via CSS selectors on the news list.
*
* Usage:
* opencli uisdc news
* opencli uisdc news --limit 10
*/
import { cli, Strategy } from '@jackwener/opencli/registry';

cli({
site: 'uisdc',
name: 'news',
description: '优设读报 - 最新 AI/设计行业新闻',
domain: 'www.uisdc.com',
strategy: Strategy.PUBLIC,
browser: true,
args: [
{ name: 'limit', type: 'int', default: 20, help: 'Number of news items to return' },
],
columns: ['rank', 'title', 'summary'],
pipeline: [
{ navigate: 'https://www.uisdc.com/news' },
{
evaluate: `
const items = Array.from(
document.querySelectorAll(
'.news-list > .news-item:first-child > .item-content > .dubao-items > .dubao-item'
)
);
return items.map((el, i) => ({
rank: i + 1,
title: el.querySelector('.dubao-title')?.textContent?.trim() ?? '',
summary: el.querySelector('.dubao-content')?.textContent?.trim() ?? '',
url: el.querySelector('a')?.href ?? '',
}));
`,
},
{ limit: '${{ args.limit }}' },
],
});