-
-
Save laventura/11dc1b017aa1a1a8cd166dccdec94f8b to your computer and use it in GitHub Desktop.
Get URL Schemes For Your Apple Books on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Path to the BKLibrary file | |
BKLIBRARY_PATH=~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary | |
# Check if BKLibrary file exists | |
if [ ! -f "$BKLIBRARY_PATH/BKLibrary-"*".sqlite" ]; then | |
echo "BKLibrary file not found. Please make sure Books app is installed and has been opened at least once." | |
exit 1 | |
fi | |
# Get the full path of the BKLibrary file | |
BKLIBRARY_FILE=$(ls "$BKLIBRARY_PATH"/BKLibrary-*.sqlite) | |
# Execute sqlite command to fetch book titles and asset IDs | |
sqlite3 "$BKLIBRARY_FILE" <<EOF | |
select ztitle, 'ibooks://assetid/' || zassetid from zbklibraryasset; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: Use SimonwW's
datasette
plugins to do something useful with the sqlite DB