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
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
/**
|
|
* dblp record detail.
|
|
*
|
|
* Fetches a single record's XML metadata at `/rec/<key>.xml` and projects
|
|
* it into a one-row table. The XML payload is small (<1KB typical) and
|
|
* uses a stable, narrow schema, so we parse it with conservative regexes
|
|
* — same approach as the arxiv adapter.
|
|
*/
|
|
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
import { EmptyResultError } from '@jackwener/opencli/errors';
|
|
import {
|
|
PAPER_COLUMNS,
|
|
dblpFetchXml,
|
|
recordXmlToRow,
|
|
requireRecordKey,
|
|
} from './utils.js';
|
|
|
|
cli({
|
|
site: 'dblp',
|
|
name: 'paper',
|
|
aliases: ['detail', 'view'],
|
|
access: 'read',
|
|
description: 'Fetch a dblp record by canonical key (e.g. conf/nips/VaswaniSPUJGKP17)',
|
|
domain: 'dblp.org',
|
|
strategy: Strategy.PUBLIC,
|
|
browser: false,
|
|
args: [
|
|
{ name: 'key', positional: true, required: true, help: 'dblp record key (round-tripped from the `key` column of `dblp search`)' },
|
|
],
|
|
columns: PAPER_COLUMNS,
|
|
func: async (args) => {
|
|
const key = requireRecordKey(args.key);
|
|
const xml = await dblpFetchXml(`/rec/${encodeURI(key)}.xml`, 'dblp paper');
|
|
const row = recordXmlToRow(xml);
|
|
if (!row.key && !row.title) {
|
|
throw new EmptyResultError('dblp paper', `dblp returned an empty record for key "${key}".`);
|
|
}
|
|
return [row];
|
|
},
|
|
});
|