Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

865 B
Raw Blame
import { cli, Strategy } from '@jackwener/opencli/registry';
import { fetchPrivateApi } from './utils.js';
cli({
    site: 'weread',
    name: 'notebooks',
    access: 'read',
    description: 'List books that have highlights or notes',
    domain: 'weread.qq.com',
    strategy: Strategy.COOKIE,
    columns: ['title', 'author', 'noteCount', 'bookId'],
    func: async (page, _args) => {
        const data = await fetchPrivateApi(page, '/user/notebooks');
        const books = data?.books ?? [];
        return books.map((item) => ({
            title: item.book?.title ?? '',
            author: item.book?.author ?? '',
            // TODO: bookmarkCount/reviewCount field names from community docs, verify with real API
            noteCount: (item.bookmarkCount ?? 0) + (item.reviewCount ?? 0),
            bookId: item.bookId ?? '',
        }));
    },
});