Introduction¶
Within the DSH plugin ecosystem, online tool plugins often need to handle details such as login sessions, cookie management, and CAPTCHA bypass. For developers who frequently query CNKI (China National Knowledge Infrastructure) for literature, the experience of manually logging in, triggering slider CAPTCHAs when paginating, and navigating through multiple redirects to download PDFs is rather cumbersome. The cnki-lit plugin, by leveraging the SUFE portal login session and CARSI authentication, provides DSH with a scriptable approach to CNKI access—chaining together search, abstract retrieval, download, and Zotero export.
Plugin Overview¶
cnki-lit is an online tool plugin for DSH, developed by maintainer Wang666645. It accesses CNKI through SUFE institutional permissions (CARSI) and supports searching, abstract retrieval, full-text download, bulk Zotero archiving, and literature review material collection. The plugin runs within the DSH process, does not depend on external browser extensions, and invokes CNKI HTTP interfaces solely via Python scripts.
Core Capabilities¶
- Authentication & Trust State Management: Reuses the
sufe-portal-cliportal session to exchange for a CARSI ticket, valid for approximately 8 hours; the trust state only requires a one-time manual slider CAPTCHA and remains valid long-term thereafter. - Literature Search: Via
cnki_search, supports searching by topic, title, keywords, abstract, author, and source, up to 50 results per query. - Literature Details: Via
cnki_detail, retrieves the abstract, keywords, authors, and PDF link for a single article. - Full-Text Download: Via
cnki_download, downloads PDF full text (within institutional subscription scope). - Bulk Collection: Via
cnki_collect, collects PDF + RIS for multiple articles and imports them into Zotero as a single package. - Review Materials: Via
cnki_review, generates a bulk abstract material package for writing literature reviews.
Installation & Activation¶
git clone https://github.com/Wang666645/cnki-lit.git
dsh plugin --profile desktop add ./cnki-lit
Or select the directory in Settings → Plugins within the app. Restart after installation.
Configuring the Python Interpreter¶
The plugin invokes cnki_lit.py from the repository, so you must specify the Python interpreter in the configuration file:
# ~/.dsh/profiles/<profile>/cordis.patch.yml
- id: cnki-lit
config:
python: 'C:\Python314\python.exe' # the one with requests + playwright installed
script: 'C:\path\to\cnki-lit\cnki_lit.py'
It can still run without this configuration, provided that python is on the PATH and pip install -r requirements.txt has been completed.
First-Time Setup¶
cnki_auth action=login # exchange portal TGC for CARSI ticket
cnki_auth action=trust # opens browser, drag the slider once
cnki_auth action=status # confirm session_ok
Tool List¶
| Tool | Function |
|---|---|
cnki_auth |
Session check / CARSI ticket exchange / establish trust state |
cnki_search |
Search, ≤50 results per query, supports topic/title/keywords/abstract/author/source |
cnki_detail |
Single-article abstract, keywords, authors, PDF link |
cnki_download |
Download PDF full text (within institutional subscription scope) |
cnki_collect |
Bulk collection → PDF + RIS, import into Zotero as a single package |
cnki_review |
Bulk abstract material package for literature review writing |
Use Cases & Notes¶
Suitable for developers with SUFE institutional access who need to perform bulk CNKI searches/downloads within DSH. The plugin runs with the current DSH process privileges; review the source code and license (MIT) before use.
Known limitations:
- Pagination CAPTCHA: pageNum=2 always triggers a slider CAPTCHA. Workaround: partition queries by year/topic and retrieve only the first page of each partition.
- Maximum 50 results per page; pageSize only accepts 20 or 50.
- Local proxies break TLS: The script sets trust_env=False; do not change it to use the system proxy.
- Zotero writes: The plugin does not connect directly to the Zotero library; it only exports RIS + PDF. Use “File → Import” to complete archiving.
Error Code Handling¶
| Code | Meaning | Resolution |
|---|---|---|
NO_SESSION |
No trust state | cnki_auth action=trust |
NO_PORTAL |
Portal not logged in | sufe-portal-cli auth --qrcode |
CARSI_FAILED |
Ticket exchange failed | Portal session expired; re-scan QR code |
TRUST_EXPIRED |
Trust state expired | Re-run action=trust |
CAPTCHA_REQUIRED |
Pagination CAPTCHA triggered | Change keywords or narrow the scope |
NOT_PDF |
No download permission | Article is outside subscription scope |
Summary¶
cnki-lit bridges the SUFE institutional access to CNKI within DSH, chaining together search, abstract retrieval, download, and Zotero export. For developers who frequently use CNKI, it provides a scriptable access method that reduces the burden of manual login and CAPTCHA handling.
- Plugin directory: https://www.skillhub.cn/plugins/Wang666645/cnki-lit
- GitHub: https://github.com/Wang666645/cnki-lit