Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lodestone/kindle
No Kindle Highlights API? Take control with this CLI!
https://github.com/lodestone/kindle
amazon cli highlights kindle ruby
Last synced: about 11 hours ago
JSON representation
No Kindle Highlights API? Take control with this CLI!
- Host: GitHub
- URL: https://github.com/lodestone/kindle
- Owner: lodestone
- License: mit
- Created: 2011-07-13T20:42:20.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T13:33:46.000Z (over 6 years ago)
- Last Synced: 2024-10-09T09:16:41.519Z (about 1 month ago)
- Topics: amazon, cli, highlights, kindle, ruby
- Language: Ruby
- Homepage:
- Size: 387 KB
- Stars: 90
- Watchers: 7
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.adoc
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.adoc
Awesome Lists containing this project
README
= Kindle Highlights for the Command Line
:author: Matt Petty
:copyright: 2016:numbered!:
NOTE: THIS IS NOT WORKING CURRENTLY, AS AMAZON CHANGED THEIR SITE
+++
+++== What is this?
The kindle highlights app gives **YOU** your kindle highlights without the poor interface Amazon has wrapped around _YOUR DATA_.
If you are like me, you make a lot of highlights while you read ebooks. I mark vocab words, great phrases, and inspirational sections.
The kindle command empowers you to actually _DO_ something with all those highlights you've been making on your Kindle and Kindle apps. The app downloads and caches your highlights. You can then get them in various formats like JSON, CSV, and a nice little Markdown format to run through pandoc or Marked app.
**Specifically, you can:**
* scrape and parse your kindle highlights and book data
* keep your highlights stored _**locally**_
* output in JSON format
* output in CSV format
* output in Markdown format
* do sophisticated queries on your data using the `kindle console`**Future plans:**
* automatic scanning for vocabulary words
* output in other formats// TODO. What is this and why do you want to use it?
== Installation
```sh
gem install kindle
```There are a lot of dependencies (including the latest Rails ActiveRecord v5), as this app is intended to provide a lot of conveniences and functionality over other lighter link:https://github.com/speric/kindle-highlights[libraries] like from our friend link:https://github.com/speric[@speric]! :heart:
== Usage:
=== Warnings and Caveats (HACKER ALERT)
image::http://i.perezhilton.com/wp-content/uploads/2014/12/hackers.gif[width="100%"]
Let's talk about passwords and security. Using the kindle command line app gives you the convenience to save your Amazon credentials in a file on your computer. This is probably bad. **Don't do it**. You've been warned.
Hax0rz *will* hack.
If, however, you intend to keep your password out of the settings file, you'll need to pass in the `--password=` argument every time. **Again: Be Forewarned**: Your shell is probably configured by default to save a history of what you type in. For that reason, you should be using something like the `zsh` option link:http://zsh.sourceforge.net/Doc/Release/Options.html[`HIST_IGNORE_SPACE`] to _"hide"_ your most-secretest commands.
---
=== Step 1: Initialization
==== kindle init
First you need to initialize the app with some default and/or customized settings, as well as create the database to store your highlights.
To initialize and save your password and username:
```sh
# Option 1
kindle --username="[email protected]" --password="yoursecret" init
```**OR**
To initialize with just a username:
```sh
# Option 2
kindle --username="[email protected]" init
```**OR**
Just run the `init` sub-command without any parameters, knowing you will just have to pass them in later. Every time.
```sh
# Option 3
kindle init
```---
=== Step 2: Fetch your data
==== kindle highlights update
The `update` sub-command uses either the passed in credentials or the saved credentials in the settings file and reaches out to Amazon's Kindle highlights website. It slurps all the highlights (and book info) and saves it in a SQLite3 database in `~/.kindle`.
```sh
kindle highlights update
```The `update` command will take a while to run, depending on how many highlights you have. Don't worry if it doesn't seem to do anything. That's okay. Trust in the UNIX-way.
---
=== Step 3: Output your data
==== kindle highlights
The `highlights` command requires a sub-command to generate the appropriate output. Currently the available output formats are: JSON, CSV, and Markdown.
Example with JSON:
```sh
# Output in json format and redirect to highlights.json file
kindle highlights json > highlights.json
```Example with CSV:
```sh
# Output in csv format and redirect to highlights.csv file
kindle highlights csv > highlights.csv
```Example with Markdown:
```sh
# Output in markdown format and redirect to highlights.md file
kindle highlights markdown > highlights.md
```---
== Advanced Topic: The Console
image::http://link.nx.is/1hbw6.png[]
I've also included a `console` command for those of you familiar with Ruby on Rails, irb, etc. Issuing the `kindle console` command will open a console session with two ActiveRecord objects: `Book` and `Highlight`. These are real ActiveRecord v5.0 models pointing to the database of highlights.
image:http://link.nx.is/Qesb.png[width="100%"]
`kindle console` examples:
```ruby
Kindle :) Book.count
=> 45Kindle :) Highlight.count
=> 587Kindle :) Highlight.first
=> #Kindle :) Book.first
=> #```
== Endcap
In case you are too lazy to open the LICENSE file, just FYI this is all MIT licensed.
(C) 2012-2016 Matt Petty link:https://github.com/lodestone[@lodestone]