0.0
No commit activity in last 3 years
No release in over 3 years
https://github.com/jgplane/clippings-pluck
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
~> 3.0
 Project Readme

clippings_pluck

Gem Version MIT

Amazon stores all of your kindle highlights and notes in a txt file called "My Clippings.txt". Amazon will also let you export those highlights as a CSV file. ClippingsPluck accepts a string read from one of those files and returns an array of hashes.

Installation

Add this line to your application's Gemfile:

gem 'clippings_pluck'

And then execute:

$ bundle

ClippingsPluck::CsvParser Usage

Note: this is the preferred way to interact with ClippingsPluck. The Kindle CSV file is much more reliable and straightforward to parse than the TXT file.

First, read from the csv file:

string = File.open("clippings.csv", "rb").read

Then, you can pass that string into ClippingsPluck like this:

ClippingsPluck::CsvParser.new.run(string)

You'll get back an array of hashes, each of which might look something like this:

{
  note: nil,
  quote: '"He was not no machine!" screamed Gloria, fiercely and ungrammatically.',
  author: "Isaac Asimov",
  book_title: "I, Robot (The Robot Series Book 1)",
  page: nil,
  location: "245",
  date: nil
}

ClippingsPluck::TxtParser Usage

Using the TXT file parser is similar:

file = File.open("./My\ Clippings.txt", "rb")
contents = file.read

Then, you can feed the string to ClippingsPluck like this:

ClippingsPluck::TxtParser.new.run(contents)

You'll get back an array of hashes, each of which might look something like this:

{
  note: nil,
  quote: '"He was not no machine!" screamed Gloria, fiercely and ungrammatically.',
  author: "Isaac Asimov",
  book_title: "I, Robot (The Robot Series Book 1)",
  page: nil,
  location: "245",
  date: "Tuesday, November 22, 2017 6:42:51 PM"
}

FAQ

Q: How do I get ahold of these highlight files?

A: Follow the instructions here.

License

The gem is available as open source under the terms of the MIT License.