Readwise imports with location #385
-
Hello, I am using QuickAdd and the EzImport script to import all my book highlights and notes from Readwise. I much prefer this solution to the official Readwise plugin as it gives me more freedom to use my Obsidian templates. I was able to tweak the js file to take into account h2 tags on top of h1 tags. Furthermore, I mostly read on paper, and I like to add the page from which the highlight was taken. From the Readwise API, we can retrieve this information with the location_type and location keys. However, I am not familiar enough with Javascript to modify the code accordingly... Here is the part of theEzImport script which, I believe, needs to be be modified :
Would anyone be able to help me out? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Glad to hear that you like EzImport. Whenever we've called the Readwise API to get highlights for a specific item, we get something like this back: {
"count": 1163,
"next": "https://readwise.io/api/v2/highlights?page=2",
"previous": null,
"results": [
{
"id": 59758950,
"text": "The fundamental belief of metaphysicians is THE BELIEF IN ANTITHESES OF VALUES.",
"note": "",
"location": 9,
"location_type": "order",
"highlighted_at": null,
"url": null,
"color": "",
"updated": "2020-10-01T12:58:44.716235Z",
"book_id": 2608248,
"tags": [
{
"id": 123456,
"name": "philosophy"
},
...
]
},
...
]
} You can e.g. edit function formatHighlights(highlights) {
return highlights.map(hl => {
if (hl.text == "No title") return;
const {quote, note} = textFormatter(hl.text, hl.note);
return `${quote}${note}\nPage: ${hl.location}\n`;
}).join("\n\n");
} Where |
Beta Was this translation helpful? Give feedback.
-
Hi Christian, It works great and your explanation is very clear. Thank you so much for your help! |
Beta Was this translation helpful? Give feedback.
Hi @CharlotteCMJ
Glad to hear that you like EzImport.
You're correct that this is the right spot to modify.
Whenever we've called the Readwise API to get highlights for a specific item, we get something like this back: