https://github.com/djtb/kindlequotes
Transform a kindle clippings text file to JSON
https://github.com/djtb/kindlequotes
clippings highlights json kindle quotes
Last synced: 6 months ago
JSON representation
Transform a kindle clippings text file to JSON
- Host: GitHub
- URL: https://github.com/djtb/kindlequotes
- Owner: DJTB
- License: mit
- Created: 2016-05-21T12:22:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:59:45.000Z (almost 3 years ago)
- Last Synced: 2025-03-29T22:17:33.648Z (7 months ago)
- Topics: clippings, highlights, json, kindle, quotes
- Language: JavaScript
- Homepage:
- Size: 842 KB
- Stars: 10
- Watchers: 0
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
Kindle Quotes
Transform Kindle 'My Clippings' text file to JSON.
### Features
* Replaces dumbquotes ' ' " " with smartquotes ‘ ’ “ ”
* Prepends highlights starting mid-sentence with an …ellipsis
* Trims large sections of spacing (from epub or pdf highlights)
* Standardises author format as Firstname Lastname
* Skips bookmarks, duplicates, and empty highlights#### Transform this:
```
==========
The Third Bear (VanderMeer, Jeff)
- Your Highlight at location 1856-1857 | Added on Monday, 1 September 2014 12:58:20Blake says, "Where?" He's a man who measures words as if he had only a few given to him by Fate; too generous a syllable from his lips, and he might fall over dead.
==========
Songs of the Dying Earth (Dozois, Gardner;Martin, George R.R.)
- Your Highlight at location 11849-11850 | Added on Thursday, 30 April 2015 20:58:20and eyeing the wizard speculatively across the room. A glance was enough to tell Molloqos that she was a woman of the evening, though in her case evening was edging on toward night.
==========
```#### Into this:
```
[
{
"title": "The Third Bear",
"authors": ["Jeff VanderMeer"],
"loc": "1856-1857",
"date": "2014-09-01T12:58:20.000Z",
"content": "Blake says, “Where?” He’s a man who measures words as if he had only a few given to him by Fate; too generous a syllable from his lips, and he might fall over dead."
},
{
"title": "Songs of the Dying Earth",
"authors": ["Gardner Dozois", "George R.R. Martin"],
"loc": "11849-11850",
"date": "2015-04-30T20:58:20.000Z",
"content": "…and eyeing the wizard speculatively across the room. A glance was enough to tell Molloqos that she was a woman of the evening, though in her case evening was edging on toward night."
}
]
```### Usage
#### As Global CLI
```bash
$ npm install -g kindlequotes
$ kindlequotes -i 'My Clippings.txt' -o 'my-quotes.json'
```##### Options
```
-i, --infile [value] Filename to read kindle highlights [Default: My Clippings.txt]
-o, --outfile [value] Filename to write JSON [Default: quotes.json]
-d, --dirname [value] Path to write outfile to [Default: current working directory]
-v, --version Output the version number
-h, --help Output this usage information
```#### As Import in a Local Project
```bash
$ npm install kindlequotes
```
```javascript
const transformQuotes = require('kindlequotes');
const fs = require('fs');
const quotes = transformQuotes(
fs.readFileSync('./My Clippings.txt', 'utf8')
);
```