siuying-kindle-highlights
Get your Kindle highlights via Amazon's Kindle site
This is a Kindle Highlight API forked from speric's gem.
Required gems
- asin
- Mechanize
The asin gem assumes you have an Associates tracking code, and Product API credentials. A handy guide for setting up the asin gem can be found at:
http://aws.amazon.com/code/3982.
The kindle-highlights gem depends on the asin gem to grab data about the product from which the highlight came, and will not work without asin being set up properly.
Install
gem install siuying-kindle-highlights
Usage
require 'kindle-highlights'
# to create a new KindleHighlight object, give it your Amazon email address and password
kindle = KindleHighlight.new("foo@bar.com", "password")
# setup asin
ASIN::Configuration.configure do |config|
config.secret = "secret"
config.key = "key"
config.associate_tag = "associate_tag"
end
# fetch items
kindle.scrape_highlights
# fetch more items, if available
while kindle.has_more?
kindle.scrape_highlights
end
# get all fetched items
kindle.highlights.each do |highlight|
highlight.annotation_id # => a unique value for each highlight, generated by Amazon
highlight.content # => the actual highlight text
highlight.note # => any note attached with the highlight
highlight.end_location # => end_location of the annotation
highlight.asin # => the Amazon ASIN for the highlight's product
highlight.author # => author of the book from which the highlight is taken
highlight.title # => title of the book from which the highlight is taken
highlight.details_url # => URL to the book
highlight.image_url # => Image of the book
end
Updates
0.0.6
- Allow fetch more than one page of highlights
- Add more fields to highlights
- Refactored to use asin and refactor the scrape_highlights logic
- Add specs
0.0.5
- Cache AWS Product API results in a Hash, keyed on ASIN, to save time
- Get Small response group from Amazon
0.0.4
- Added dependencies to Mechanize and ruby-aaws within gemspec (0.0.4)
0.0.3
- Added annotation_id to Highlight class (0.0.3)