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
23 lines
865 B
JavaScript
23 lines
865 B
JavaScript
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 ?? '',
|
|
}));
|
|
},
|
|
});
|