hadynz / obsidian-kindle-plugin

Sync your Kindle notes and highlights directly into your Obsidian vault
MIT License
922 stars 52 forks source link

[BUG] highlight createdDate returning as today's date #210

Closed jamesvclements closed 1 year ago

jamesvclements commented 1 year ago

Describe the bug

createdDate doesn't exist on highlights:

How to Win Friends and Influence People (Dale Carnegie) - main - Obsidian v1 0 0-Monday-October-24-2022-09 47 05AM@2x

How to Win Friends and Influence People (Dale Carnegie) - main - Obsidian v1 0 0-Monday-October-24-2022-09 47 27AM@2x

Method of syncing

Metadata

jamesvclements commented 1 year ago

Is this only available when using clippings.txt? I'm not certain I see the highlight date in the web page I think is being scraped:

Kindle Your Notes and Highlights-Monday-October-24-2022-09 50 21AM@2x

tonyxiao commented 1 year ago

@jamesvclements / @hadynz Readwise's extension is able to get it somehow. I tested and it works appropriately as the highlighted date (though not 100% available on all highlights) CleanShot 2022-11-03 at 12 58 32@2x

tonyxiao commented 1 year ago

This is the #1 reason preventing me from switching to this plugin from readwise (prefer this plugin as I often read on the iPad and readwise requires me to be on my computer with browser open for the sync to work...)

hadynz commented 1 year ago

A clipping's highlight date time exists in the My Clippings file. But I have not been able to find it in the online Kindle Reader page, meaning the information is not available for the plugin to scrape.

I am surprised that Readwise has this field available!

tonyxiao commented 1 year ago

Maybe give it a try via readwise and you can identify a book that has the right highlight dates. As not all books have them.

hadynz commented 1 year ago

@tonyxiao I have a good amount of books in my Kindle library and haven't run into an example were the created dates were visible in the online Kindle Reader.

It seems you have found one such example. Do you mind that for the book that Readwise shows highlight date that you go to the Kindle Reader and inspect the DOM to see where these dates are visible? That would help me a lot.

At the moment I simply cannot recreate this.

hadynz commented 1 year ago

I just pulled out Readwise's chrome extension code and went through to see how they scraped creation date of highlights. They simply don't have that logic in their extension, meaning that that these dates must come from another source (Kindle Clippings?).

I don't believe that this feature is possible.

jamesvclements commented 1 year ago

@hadynz I did a little research and it seems like Readwise's sync does have a date, but it's not correct. I tested with a few different books from the past few years and they're all adding a date to the highlights, but it's the same date for every highlight, and I know that most of the highlights occurred on different days. I'm not sure what they're using to supply the date.

This still leaves me wondering — is there anywhere that Kindle stores the exact datetime you highlighted something?

Here's what I see for my Readwise <> Obsidian sync trying to use {{highlight_date}}:

https://share.cleanshot.com/iugjOp

jamesvclements commented 1 year ago

@hadynz looks like Readwise is using the "last accessed date" for all the highlights: Kindle Your Notes and Highlights-Wednesday-November-09-2022-08 28 46AM@2x

@tonyxiao are you certain Readwise is providing your correct highlight dates, or is it just the last date you accessed the book for each highlight?

hadynz commented 1 year ago

That's right. The only available date that we know is when a book was last accessed. Annotating highlights with that date is inaccurate. However, it can be accurate if someone has a habit of syncing their highlights on a daily basis - which might be the big assumption that Readwise is making. This plugin has that date and makes it available to use in any of its templates. So you can get the same result.

The Kindle Clippings file does have the created date for a highlight available and the plugin will use it correctly.

tonyxiao commented 1 year ago

Hmm i think you are right, it might be the lastAccessed date. As all my highlight_date are the same despite the fact that I highlighted them on different days.

jamesvclements commented 1 year ago

@hadynz that's a great point that last accessed becomes useful if synced everyday.

Could you add lastAnnotatedDate as a variable for the highlight template?

Company Of One (Paul Jarvis) - main - Obsidian v1 0 3-Thursday-November-10-2022-11 45 39AM@2x

hadynz commented 1 year ago

I'll make an update to make the variable available in the highlight template and update this thread when it's complete

tonyxiao commented 1 year ago

By tge way is there a way to get clippings.txt without a kindle device handy?

hadynz commented 1 year ago

By tge way is there a way to get clippings.txt without a kindle device handy?

No, that's not possible. It is a physical file that is stored and updated on the Kindle device as you use the device.

tonyxiao commented 1 year ago

I see. Do you know if it contains only the highlights you made on that device or all highlights from your entire kindle account?

hadynz commented 1 year ago

Only highlights made on this specific device.