georgboe / kindleclippings Goto Github PK
View Code? Open in Web Editor NEWA gem to parse Kindle's "My Clippings.txt" file into ruby objects.
License: MIT License
A gem to parse Kindle's "My Clippings.txt" file into ruby objects.
License: MIT License
Hi :)
I was using the script to import my clippings on to a database and noticed some clipping types were being incorrectly parsed, specifically on clippings with a Page information :
- Highlight on Page 142 | Loc. 2170-74 | Added on Tuesday, July 03, 2012, 07:41 PM
I changed the regular expression on the parser.rb file to capture the first word after the initial dash and ignore everything up to Loc . It's an intermediate solution until I actually look into the semantics of that Page information (the correct thing would be to capture the page value) , but either way , here's the changed line :)
second_line = lines[1].strip.scan(/^- (\w*)(?:.+?)Loc. ([0-9-]*?) +\| Added on (.+)$/i).first
Thanks guys, the rest works like a charm :)
I noticed the parser was giving me only the first paragraph of a long highlight even though the whole thing was in 'My Clippings.txt'. The parser seems to assume the kindle will always store highlights on a single line, but apparently that's not the case. (Basically I was highlighting a chunk of a bibliography.)
To fix for myself I just replaced lines 60-64 with line 61 in kindleclippings.rb.
I notice that if the author is empty, when getting Notes the gem cannot retrieve author but also Title.
The Danger of += in JavaScript
Static Code Analysis and Code Contracts
To fix this I edit the parser around line 40
before it was:
title, author = *first_line
and new way:
if first_line.nil?
title = lines[0]
author = ""
else
title, author = *first_line
end
I know that is not pretty but it works....
This gem looks awesome, but was curious to hear your thoughts about optional integration with the Amazon Product API directly, rather than having to write separate components for this.
I'd be happy to contribute a method that queries the product API (via ItemSearch, limiting to Kindle titles with a title match), then includes some extra accessors like asin
, product_image
and a link. If you'd like to have this let me know and I'll open a PR.
(What I want to build is fairly simple, simply want to generate a "living" list of my highlights with the links to the book)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.