Skip to main content

Zotero CLI Tweet

Sort and rank your Zotero references easy from your CLI.

PyPi Platform Python Versions Build Status Read The Docs Known Vulnerabilities DOI License

This Tinyscript tool relies on pyzotero for communicating with Zotero's Web API. It allows to list field values, show items in tables in the CLI or also export sorted items to an Excel file.

$ pip install zotero-cli-tool

:fast_forward: Quick Start

The first time you start it, the tool will ask for your API identifier and key. It will cache it to ~/.zotero/creds.txt with permissions set to rw for your user only. Data is cached to ~/.zotero/cache/. If you are using a shared group library, you can either pass the "-g" ("--group") option in your zotero-cli command or, for setting it permanently, touch an empty file ~/.zotero/group.

  • Manually update cached data
$ zotero-cli reset

Note that it could take a while. That's why caching is interesting for further use.

  • Count items in a collection
$ zotero-cli count --filter "collections:biblio"
123
  • List values for a given field
$ zotero-cli list itemType

    Type             
    ----             
    computer program 
    conference paper 
    document         
    journal article  
    manuscript       
    thesis           
    webpage          
  • Show entries with the given set of fields, filtered based on multiple critera and limited to a given number of items
$ zotero-cli show year title itemType numPages --filter "collections:biblio" --filter "title:detect" --limit ">date:10"

    Year  Title                                                                                                                             Type              #Pages 
    ----  -----                                                                                                                             ----              ------ 
    2016  Classifying Packed Programs as Malicious Software Detected                                                                        conference paper  3      
    2016  Detecting Packed Executable File: Supervised or Anomaly Detection Method?                                                         conference paper  5      
    2016  Entropy analysis to classify unknown packing algorithms for malware detection                                                     conference paper  21     
    2017  Packer Detection for Multi-Layer Executables Using Entropy Analysis                                                               journal article   18     
    2018  Sensitive system calls based packed malware variants detection using principal component initialized MultiLayers neural networks  journal article   13     
    2018  Effective, efficient, and robust packing detection and classification                                                             journal article   15     
    2019  Efficient automatic original entry point detection                                                                                journal article   14     
    2019  All-in-One Framework for Detection, Unpacking, and Verification for Malware Analysis                                              journal article   16     
    2020  Experimental Comparison of Machine Learning Models in Malware Packing Detection                                                   conference paper  3      
    2020  Building a smart and automated tool for packed malware detections using machine learning                                          thesis            99     
  • Export entries
$ zotero-cli export year title itemType numPages --filter "collections:biblio" --filter "title:detect" --limit ">date:10"
$ file export.xlsx 
export.xlsx: Microsoft Excel 2007+
  • Use a predefined query
$ zotero-cli show - --query "top-50-most-relevants"

Note: "-" is used for the field positional argument to tell the tool to select the predefined list of fields included in the query.

This is equivalent to:

$ zotero-cli show year title numPages itemType --limit ">rank:50"

Available queries:

  • no-attachment: list of all items with no attachment ; displayed fields: title

  • no-url: list of all items with no URL ; displayed fields: year, title

  • top-10-most-relevants: top-10 best ranked items ; displayed fields: year, title, numPages, itemType

  • top-50-most-relevants: same as top-10 but with the top-50

  • Mark items

$ zotero-cli mark read --filter "title:a nice paper"
$ zotero-cli mark unread --filter "title:a nice paper"

Markers:

  • read / unread: by default, items are displayed in bold ; marking an item as read will make it display as normal
  • irrelevant / relevant: this allows to exclude a result from the output list of items
  • ignore / unignore: this allows to completely ignore an item, including in the ranking algorithm

:bulb: Special Features

Some additional fields can be used for listing/filtering/showing/exporting data.

  • Computed fields

    • authors: the list of creators with creatorType equal to author
    • citations: the number of relations the item has to other items with a later date
    • editors: the list of creators with creatorType equal to editor
    • numAttachments: the number of child items with itemType equal to attachment
    • numAuthors: the number of creators with creatorType equal to author
    • numCreators: the number of creators
    • numEditors: the number of creators with creatorType equal to editor
    • numNotes: the number of child items with itemType equal to note
    • numPages: the (corrected) number of pages, either got from the original or pages field
    • references: the number of relations the item has to other items with an earlier date
    • year: the year coming from the datetime parsing of the date field
  • Extracted fields (from the extra field)

    • comments: custom field for adding comments
    • results: custom field for mentioning results related to the item
    • what: custom field for a short description of what the item is about
    • zscc: number of Scholar citations, computed with the Zotero Google Scholar Citations plugin
  • PageRank-based reference ranking algorithm

    • rank: computed field aimed to rank references in order of relevance ; this uses an algorithm similar to Google's PageRank while weighting references in function of their year of publication (giving more importance to recent references, which cannot have as much citations as older references anyway)

:clap: Supporters

Stargazers repo roster for @dhondta/zotero-cli

Forkers repo roster for @dhondta/zotero-cli

Back to top

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zotero-cli-tool-1.6.0.tar.gz (94.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zotero_cli_tool-1.6.0-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file zotero-cli-tool-1.6.0.tar.gz.

File metadata

  • Download URL: zotero-cli-tool-1.6.0.tar.gz
  • Upload date:
  • Size: 94.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/5.1.0 pkginfo/1.8.2 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.10

File hashes

Hashes for zotero-cli-tool-1.6.0.tar.gz
Algorithm Hash digest
SHA256 52574ca960c2fc9d7693685b9fffc0b9864eb887524f99ea9ab06a65a77340b6
MD5 13c336aa3967b686923bb3d1772b23c0
BLAKE2b-256 10e174352dff229f9599e8d27f9be5bf8e60c498b94596064239b77d179d339b

See more details on using hashes here.

File details

Details for the file zotero_cli_tool-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: zotero_cli_tool-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/5.1.0 pkginfo/1.8.2 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.10

File hashes

Hashes for zotero_cli_tool-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2beabcd01783e352ef44a2bdd7a58739b1a229de667fdd8dcc0a5100a5eebad
MD5 7d2124b55a3707e267eaa4442cc108ec
BLAKE2b-256 c7c866f0b082bb0d4ebc411d676904b1f0d9c8f0a724ee683cb53f680844d364

See more details on using hashes here.

Release history Release notifications | RSS feed

1.7.5

2 files

1.7.4

2 files

1.7.3

2 files

1.7.2

2 files

1.7.1

2 files

1.6.8

2 files

1.6.7

2 files

1.6.6

2 files

1.6.5

2 files

1.6.4

2 files

1.6.3

2 files

1.6.2

2 files

This release

1.6.0 This release

2 files

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.4.1

1 file

1.4.0

1 file

1.3.1

1 file

1.3.0

1 file

1.2.9

1 file

1.2.7

1 file

1.2.6

1 file

1.2.5

1 file

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.1

1 file

1.1.0

1 file

1.0.7

1 file

1.0.5

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page