Blinkist-to-Readwise is a script to extract highlights from your Blinkist account and upload them to your Readwise account.
You also have the option to extract your Blinkist highlights to a CSV file.
To get a local copy up and running follow these simple steps.
- Have a Blinkist account, to which you log in using email and password.
Other methods of connection (e.g. with Google) are not currently supported by the script. - (Optional) Get the token required to access your Readwise account, if you wish to upload Blinkist highlights to Readwise.
You can find this token here. - Have Python version >= 3.7 installed on your system.
- Have Chrome installed on your system.
- Have a ChromeDriver added to your system’s PATH (required to run
selenium
). Please refer to this wiki for downloading and setting up ChromeDriver.
- Clone this repository.
git clone https://github.com/tibobrc/Blinkist2Readwise.git
- Navigate to the directory and install the pre-requisite packages:
- Using pip:
pip install -r requirements.txt
- Using conda:
conda install --file requirements.txt
- Using pip:
blinkist2readwise.py [-h] [-d] [-s] [-t TOKEN_READWISE] blinkist_email blinkist_password
Required positional arguments:
blinkist_email
: the email address used to log in to your Blinkist accountblinkist_password
: the password used to log in to your Blinkist account
Optional arguments:
-h
,--help
: show the help message and exit-d
,--download
: download all Blinkist highlights into a CSV file.-s
,--show-chrome
: show the Chrome window while extracting Blinkist highlights-t TOKEN_READWISE
,--token-readwise TOKEN_READWISE
: specify the token used to access your Readwise highlights.
Note: If you run the script without specifying a Readwise token, then the script will automatically download all your Blinkist highlights into a CSV. In that case, the option -d
is redundant.
If you wish to upload your Blinkist highlights to Readwise without downloading the CSV file and without seeing the generated Chrome window, navigate into the directory you cloned and run
python blinkist2readwise.py -t your_readwise_token your_blinkist_email your_blinkist_password
, replacing your_readwise_token
, your_blinkist_email
and your_blinkist_password
with your actual credentials.
When executed, the script follows these steps:
- If the user chose to upload the Blinkist highlights to Readwise (option
-t
) and not to download all Blinkist highlights into a CSV (i.e. not the option-d
), use therequests
package and the token passed when calling the script to fetch the user's current Readwise highlights from the Readwise API.
These Readwise highlights will later be used to only load Blinkist highlights which are not already saved in the user's Readwise account. - Use the
selenium
package to navigate to the highlights page on the Blinkist website, and:- Allow cookies, if prompted to.
- Enter the user's Blinkist credentials which were passed when calling the script.
- Click on the login button.
- Order the highlights by date (if login successful).
- If the user chose to upload the Blinkist highlights to Readwise and not to download all Blinkist highlights into a CSV:
- Use the
beautifulsoup4
andlxml
packages to extract the highlights information currently visible on the webpage. - Check if the oldest Blinkist highlight currently visible on the webpage is already saved in Readwise. If not, use the
selenium
package to click on the "Load More" button and repeat step 3.
- Use the
- If the user chose to save all the Blinkist highlights into a CSV, or did not specify a Readwise token, then use the
selenium
package to keep clicking on the "Load More" button as long as there are more highlights to load. - Use the
beautifulsoup4
andlxml
packages to extract the highlights from the Blinkist webpage. - Use the
requests
package and the Readwise token passed when calling the script to upload the highlights to Readwise through the Readwise API.
All contributions are very welcome!
Please make sure to follow these guidelines:
Distributed under the MIT License. See LICENSE for more information.