跳到正文
Skillpedia
自动化51k · #3549

pyzotero

它能做什么

这个程序可以帮你管理 Zotero 中的文献参考信息。你可以自动搜索、添加、修改或删除条目、集合和附件。

适用场景

  • ✓当你需要整理大量科学文章时。
  • ✓当你为学术工作导出引用文献时。
  • ✓如果你想自动把 PDF 文件上传到对应的文献条目中。

技能链接

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pyzotero/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pyzotero/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我在我的 Zotero 文库中搜索所有关于人工智能的文章,并将它们导出为 BibTeX 格式。”

每周 5 个新技能,1 分钟读完。

工作原理

程序会使用你的账户凭据连接到你的 Zotero 账户。之后,你就可以发出指令,读取、写入或修改你的文献参考信息。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Pyzotero

Pyzotero is a Python wrapper for the Zotero API v3. Use it to programmatically manage Zotero libraries: read items and collections, create and update references, upload attachments, manage tags, and export citations.

Reviewed target: pyzotero 1.15.2 on 2026-09-30. Checked official SDK documentation, release source, and Web API contracts. Examples requiring a private library or running Zotero are illustrative; read-only public probes and isolated SDK contract checks do not establish authenticated write success.

Authentication Setup

For remote private reads and writes, get credentials from https://www.zotero.org/settings/keys:

Store credentials in environment variables or a .env file:

ZOTERO_LIBRARY_ID=your_user_id
ZOTERO_API_KEY=your_api_key
ZOTERO_LIBRARY_TYPE=user  # or "group"

See references/authentication.md for full setup details.

Installation

uv add "pyzotero==1.15.2"    # Reviewed Web API client
uv add "pyzotero[cli]==1.15.2"  # + local CLI
uv add "pyzotero[mcp]==1.15.2"  # + MCP server

Quick Start

import os
from pyzotero import Zotero

zot = Zotero(
    library_id=os.environ['ZOTERO_LIBRARY_ID'],
    library_type=os.environ.get('ZOTERO_LIBRARY_TYPE', 'user'),
    api_key=os.environ['ZOTERO_API_KEY'],
)

# Retrieve top-level items (returns 100 by default)
items = zot.top(limit=10)
for item in items:
    print(item['data'].get('title', ''), item['data']['itemType'])

# Search by keyword
results = zot.items(q='machine learning', limit=20)

# Retrieve all items (use everything() for complete results)
all_items = zot.everything(zot.items())

Core Concepts

  • A Zotero instance is bound to a single library (user or group). All methods operate on that library.
  • Item data lives in item['data']. Access fields like item['data']['title'], item['data']['creators'].
  • Pyzotero returns 100 items by default (API default is 25). Use zot.everything(zot.items()) to get all items.
  • Return types are method-specific: update_item() reports Boolean success, while create_items() returns per-item creation status. Inspect its failed, successful (full saved objects), success (legacy keys), and unchanged mappings and retain the input-index-to-key mapping. A truthy response dictionary does not establish that every item was created; report partial failures and retry only the failed inputs after reconciliation. See the write-method contracts.

Reference Files

File Contents
references/authentication.md Credentials, library types, local mode
references/read-api.md Retrieving items, collections, tags, groups
references/search-params.md Filtering, sorting, search parameters
references/write-api.md Creating, updating, deleting items
references/collections.md Collection CRUD operations
references/tags.md Tag access and management
references/files-attachments.md File download and attachment uploads
references/exports.md BibTeX, CSL-JSON, bibliography export
references/pagination.md follow(), everything(), generators
references/full-text.md Full-text content indexing and access
references/saved-searches.md Saved search management
references/cli.md Command-line interface (local Zotero)
references/mcp.md MCP server for LLM clients (local Zotero)
references/error-handling.md Errors and exception handling

Common Patterns

Fetch and modify an item

item = zot.item('ITEMKEY')
item['data']['title'] = 'New Title'
zot.update_item(item)

…

常见问题

我需要先安装 Zotero 吗?

需要。如果要使用本地版本,你需要先安装并配置好 Zotero。

程序怎么知道该使用哪个文库?

你需要提供 User ID、API Key 以及文库类型(个人库 user 或群组库 group),程序才能正确连接。

我可以把 PDF 文件添加到文献参考中吗?

可以。程序支持把附件(例如 PDF 文件)上传到 Zotero 文库中的条目里。

详情

作者的原始描述

Manages Zotero reference libraries using the pyzotero Python client: retrieves, creates, updates, and deletes items, collections, tags, and attachments via the Zotero Web API v3 or local API. Applies when working with Zotero libraries programmatically, managing bibliographic references, exporting citations, searching library contents, uploading PDF attachments, or building research automation work

repo: K-Dense-AI/scientific-agent-skills

热度

GitHub 星标
51k
排名
#3549
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能