When highlighting text in a Google Play Books ebook, the resulting notes are saved in a Document in the user's Drive. The purpose of this script is to extract the notes so that they can be saved in a more manageable format, such as Markdown.
Before we can execute the script, we need to run a few steps:
- In Google Drive, open the Notes file of the book that you wish to export;
- Click on "File" > "Download" and select "Web Page (.html, zipped)"
![Notes file in Google Drive](https://private-user-images.githubusercontent.com/13990245/282317529-d8e0de27-07de-4d75-9598-035e7304d0a6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0ODM3MDcsIm5iZiI6MTcyNTQ4MzQwNywicGF0aCI6Ii8xMzk5MDI0NS8yODIzMTc1MjktZDhlMGRlMjctMDdkZS00ZDc1LTk1OTgtMDM1ZTczMDRkMGE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA0VDIwNTY0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQwOTVkOWFmOGU2YTlhZTIyMTBhYzg5NGE0N2MwZGEwNDUzZGI2NDhkYjI2YjRjMmYyNGE0Zjg2YTViZDE0NjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.yMyku2FgNyT0rSOq5VYfYp3TPCfMKa2uaePtt_aHXPA)
- Save the
.zip
file to your computer, e.g. in theDownloads
folder, and extract it.
python3 -m venv env
source env/bin/activate
python3 extractor.py --file="path/to/your/NotesfromXYZ.html"