Zotero2Readwise - A Python Library to retrieve annotations and notes from Zotero and upload them to your Readwise

Overview

Zotero ➡️ Readwise

zotero2readwise is a Python library that retrieves all Zotero annotations† and notes. Then, It automatically uploads them to your Readwise§§.

This is particularly useful for the new Zotero PDF Reader that stores all highlights in the Zotero database. The new Zotero, also available for iOS app (currently in beta). In the new Zotero, the annotations are NOT saved in the PDF file unless you export the highlights in order to save them.

If you annotate your files outside the new Zotero PDF reader, this library may not work with your PDF annotations as those are not retrievable from Zotero API.

This library is for you if you annotate (highlight + note) using the Zotero's PDF reader (including the Zotero iOS)

👉 Updating an existing Zotero annotation or note and re-running this library will update the corresponding Readwise highlight without creating a duplicate!

† Annotations made in the new Zotero PDF reader and note editor.

§ Readwise is a paid service/software that integrates your highlights from almost everywhere (Pocket, Instapaper, Twitter, Medium, Apple Books, and many more). It even has an amazing OCR for directly importing your highlights on a physical book/article into Readwise and allowing you to export all your highlights to Obsidian, Notion, Roam, Markdown, etc. Moreover, It has an automated Spaced Repition and Active Recall. You can use the the link here to get an extra free month (Disclaimer: I will get a free month too!)


Installation

You can install the library by running

pip install zotero2readwise

Note: If you do not have pip installed on your system, you can follow the instructions here.

Usage

Since we have to retrieve the notes from Zotero API and then upload them to the Readwise, the minimum requirements are:

  • Readwise access token [Required]: You can get your access token from https://readwise.io/access_token
  • Zotero API key [Required]: Create a new Zotero Key from your Zotero settings
  • Zotero personal or group ID [Required]:
    • Your personal library ID (aka userID) can be found here next to Your userID for use in API calls is XXXXXX.
    • If you're using a group library, you can find the library ID by
      1. Go to https://www.zotero.org/groups/
      2. Click on the interested group.
      3. You can find the library ID from the URL link that has format like https://www.zotero.org/groups/<group_id>/group_name. The number between /groups/ and /group_name is the libarry ID.
  • Zotero library type [Optional]: "user" (default) if using personal library and "group" if using group library.

Note that if you want to retrieve annotations and notes from a group, you should provide the group ID (zotero_library_id=<group_id>) and set the library type to group (zotero_library_type="group").

Approach 1 (Recommended)

from zotero2readwise.zt2rw import Zotero2Readwise

zt_rw = Zotero2Readwise(
    readwise_token="your_readwise_access_token",  # Visit https://readwise.io/access_token)
    zotero_key="your_zotero_key",  # Visit https://www.zotero.org/settings/keys
    zotero_library_id="your_zotero_id", # Visit https://www.zotero.org/settings/keys
    zotero_library_type="user", # "user" (default) or "group"
    include_annotations=True, # Include Zotero annotations -> Default: True
    include_notes=False, # Include Zotero notes -> Default: False
)
zt_rw.run()

Just to make sure that all files are created, you can run save_failed_items_to_json() from readwise attribute of the class object to save any highlight that failed to upload to Readwise. If a file or more failed to create, the filename (item title) and the corresponding Zotero item key will be saved to a txt file.

zt_rw.readwise.save_failed_items_to_json("failed_readwise_highlights.json")

Approach 2

You can use the run.py script. Run python run.py -h to get more information about all options. You can simply run the script as the following:

python run.py <readwise_token> <zotero_key> <zotero_id> 

Request a new feature or report a bug

Feel free to request a new feature or report a bug in GitHub issue here.

📫 How to reach me:

Personal Website LinkedIn Medium Twitter

Buy Me A Coffee

Comments
  • Update README.md

    Update README.md

    Link to Zotero Settings changed from https://www.zotero.org/settings/key to https://www.zotero.org/settings/keys

    I also added /new to directly link to generating a new key, maybe you could explain which settings are needed for a new key (read/write).

    opened by floriankilian 1
  • Fix invalid link to Zotero Settings page

    Fix invalid link to Zotero Settings page

    Thank you so much for your great work! While setting up my forked repo, I noticed a broken link, so I fixed it.

    "https://www.zotero.org/settings/key" to "https://www.zotero.org/settings/keys"

    opened by nobuyukioishi 0
  • Send case law and other types of documents to Readwise?

    Send case law and other types of documents to Readwise?

    Would it be possible to send other types of documents other than books and articles to Readwise? For example I annotate a lot of case law and laws and reports. I’m fine if these are categorised as articles if this means they are also sent to Readwise.

    But if it’s possible to categorise them correctly and get them into Readwise that’d be wonderful! Is this a possibility?

    opened by ABeehive 0
  • Partial push of highlights to Readwise

    Partial push of highlights to Readwise

    Currently, the library fetches all Zotero highlights/notes and pushes them to Readwise each time.

    For efficiency and also in order to avoid any potential duplicated highlights due to either library changes or changes in Readwise de-duplication algorithm, the library should be able to push only latest highlights.

    This is related to the issue #31.

    opened by e-alizadeh 0
  • After the last release all my articles from Zottero got duplicated

    After the last release all my articles from Zottero got duplicated

    As in the title. I have set the cronjob for 3 am every day. And on 20 Oct (after the new release on 19 Oct) all the articles got pushed to the Zotero second time. I tried to simply remove them, but they got pushed again. Can we somehow fix this issue?

    opened by piojanu 6
  • Z2R.zt2rw Approach 2 (through python terminal) stopped working in July 2022

    Z2R.zt2rw Approach 2 (through python terminal) stopped working in July 2022

    It goes through the normal sequence in python, exactly as before but highlights just no longer appear in Readwise. I recreated my zotero key and readwise token and still not appearing. No errors, zotero seems to be collating and pushing the data to Readwise.

    Anyone else experiencing this? Did Readwise change something on their end?

    opened by bcmorrison3 6
  • Only sync pre-specified color(s)?

    Only sync pre-specified color(s)?

    It would be convenient to have a highlight color which signifies "I want this to be synced to Readwise". In my case, most of my highlights aren't review-worthy in a generalized context outside of whatever research I'm doing. Some small amount are.

    image

    I imagine most people don't use all of the available options anyway.

    opened by deklanw 0
Releases(v0.2.6)
Owner
Essi Alizadeh
Engineer & Data Scientist in Permanent Beta: Learning, Improving, Evolving ...
Essi Alizadeh
a small library for extracting rich content from urls

A small library for extracting rich content from urls. what does it do? micawber supplies a few methods for retrieving rich metadata about a variety o

Charles Leifer 588 Dec 27, 2022
News, full-text, and article metadata extraction in Python 3. Advanced docs:

Newspaper3k: Article scraping & curation Inspired by requests for its simplicity and powered by lxml for its speed: "Newspaper is an amazing python li

Lucas Ou-Yang 12.3k Jan 1, 2023
fast python port of arc90's readability tool, updated to match latest readability.js!

python-readability Given a html document, it pulls out the main body text and cleans it up. This is a python port of a ruby port of arc90's readabilit

Yuri Baburov 2.2k Dec 28, 2022
Module for automatic summarization of text documents and HTML pages.

Automatic text summarizer Simple library and command line utility for extracting summary from HTML pages or plain texts. The package also contains sim

Mišo Belica 3k Jan 3, 2023
Notes-Django: an advanced project to save notes in Django. where users are able to Create, Read, Update and Delete their notes.

An advanced software to keep you notes. It allows users to perform CRUD operations on theirs Notes. Was implemented Authorization and Authentication

Edilson Pateguana 1 Feb 5, 2022
One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.

AwesomeVersion One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind

Joakim Sørensen 39 Dec 31, 2022
Mysterium the first tool which permits you to retrieve the most part of a Python code even the .py or .pyc was extracted from an executable file, even it is encrypted with every existing encryptage. Mysterium don't make any difference between encrypted and non encrypted files, it can retrieve code from Pyarmor or .pyc files.

Mysterium the first tool which permits you to retrieve the most part of a Python code even the .py or .pyc was extracted from an executable file, even it is encrypted with every existing encryptage. Mysterium don't make any difference between encrypted and non encrypted files, it can retrieve code from Pyarmor or .pyc files.

Venax 116 Dec 21, 2022
A simple toolchain for moving Remarkable highlights to Readwise

A simple toolchain for moving Remarkable highlights to Readwise

zach wick 20 Dec 20, 2022
A basic notes app to store your notes.

Notes Webapp A basic notes webapp to keep your notes.You can add, edit and delete notes after signing up. To add a note type your note in the text box

null 2 Oct 23, 2021
Zotero references script (and app)

A little script (and PyInstaller build) for a very specific, somewhat hack-ish purpose: managing and exporting project references with Zotero and its API.

Marius Rödder 0 Dec 5, 2021
Translation for Trilium Notes. Trilium Notes 中文版.

Trilium Translation 中文说明 This repo provides a translation for the awesome Trilium Notes. Currently, I have translated Trilium Notes into Chinese. Test

null 743 Jan 8, 2023
The program converts Swiss notes into American notes

Informatik-Programmieren Einleitung: Das Programm rechnet Schweizer Noten in das Amerikanische Noten um. Der Benutzer kann seine Note eingeben und der

null 2 Dec 16, 2021
A simple API to upload notes or files to KBFS

This API can be used to upload either secure notes or files to a secure KeybaseFS folder.

Dakota Brown 1 Oct 8, 2021
This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube.

This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube. If you wanted to create a tiktok video compiilation youtubbe channel this script is here to help you :D

Supriyo Sarkar 32 Dec 16, 2022
Retrieve annotated intron sequences and classify them as minor (U12-type) or major (U2-type)

(intron I nterrogator and C lassifier) intronIC is a program that can be used to classify intron sequences as minor (U12-type) or major (U2-type), usi

Graham Larue 4 Jul 26, 2022
❄️ Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them!

TokenCleaner Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them! If you have a very large qua

0xVichy 59 Nov 14, 2022
A small project where I identify notes and key harmonies in a piece of music and use them further to recreate and generate the same piece of music through Python

A small project where I identify notes and key harmonies in a piece of music and use them further to recreate and generate the same piece of music through Python

null 5 Oct 7, 2022
This is an app that allows users to upload photos and display and store the photos in a file until the user deletes them.

Qt Photo App This is an app that allows users to upload photos and display and store the photos in a file until the user deletes them. Setup python3 -

Kathy Yang 5 Jan 22, 2022
A Telegram bot to download youtube playlists and upload them to telegram. (may be slow becoz youtube limitations)

YTPlaylistDL ?? A Telegram bot to download youtube playlists and upload them to telegram. (may be slow becoz youtube limitations) ?? Follow me and sta

Anjana Madu 43 Dec 28, 2022