Giter Club home page Giter Club logo

Comments (5)

tdnzr avatar tdnzr commented on June 30, 2024 1

For documentation, this issue was implemented in this commit: 943f91a

from readwise-mirror.

jsonMartin avatar jsonMartin commented on June 30, 2024

Hi @tdnzr , I just investigated this for you and it appears that it's looking like answer A.

As you guessed, it appears that this particular field is not exposed by the APIs used in this plugin. It looks like the field you're looking for is readwise_url; however, that field is only exposed on the Export API which sends the entire Readwise library (which is how other plugins, such as Notion's work).

However, this plugin uses Readwise's "Advanced" API in order to only sync updated data and fetch newly updated items, and this endpoint contains different fields. This is an example of what highlights API returns:

{
  "id": 13,
  "text": "To be alone for any length of time is to shed an outer skin. The...",
  "note": "",
  "location": 57,
  "location_type": "location",
  "highlighted_at": "2020-02-02T16:46:07Z",
  "url": null,
  "color": "yellow",
  "updated": "2020-04-06T12:30:52.318552Z",
  "book_id": 1337,
  "tags": []
}

You can check out Readwise's API documentation here: https://readwise.io/api_deets

from readwise-mirror.

tdnzr avatar tdnzr commented on June 30, 2024

(EDIT: This reply is obsolete, see my next comment.)

  1. Thanks for the links to the Readwise API documentation. I think you're right that the Advanced API doesn't provide what I want, but I don't think the readwise_url field is what I want, because it doesn't actually link to the aforementioned URL https://read.readwise.io/read/some_string. The closest guess I have for what I actually want is that some_string might be the same as the external_id field exposed in the Export API.

  2. That said, in your example above, what is the "url" field in the highlights API? Its value is null in your example, and the field isn't even mentioned in your readme, but is its value ever not null? Maybe if one makes highlights in Readwise Reader, this might be the Reader URL https://read.readwise.io/read/some_string?

  3. Finally, the API docs mention that one can use the Export API for syncing updated data, i.e. without fetching the entire library each time, by providing extra parameters:

Parameters:

  • updatedAfter – (Optional, Formatted as ISO 8601 date) Fetch only highlights updated after this date.
  • ids – (Optional) Comma-separated list of user_book_ids, returns all highlights for these books only.
  • pageCursor – (Optional) A string returned by a previous request to this endpoint. Use it to get the next page of books/highlights if there are too many for one request.

The recommended way to use this endpoint is to first sync all of a user's historical data by passing no parameters on the first request, then pageCursor until there are no pages left. Then later, if you want to pull newly updated highlights, just pass updatedAfter as the time you last pulled data. This is shown in the examples on the right.

from readwise-mirror.

tdnzr avatar tdnzr commented on June 30, 2024

Hey there, I've asked on Discord, and supposedly the url endpoint is indeed the thing I care about. So this issue can indeed be implemented in Readwise Mirror.

Quoting from Discord here

My question:

In the Readwise export API, is there an equivalent to the field "highlight_location_url", which is used by the official Readwise export plugins to display the "View Highlight" (= in Reader) URL (https://read.readwise.io/read/some_string )? Having browsed the Readwise API at https://readwise.io/api_deets, I can't find such an equivalent. My best guess is that possibly, the external_id field might be equivalent to some_string in the aforementioned Reader URL.

Answer:

It's the highlight_url in the Highlight CREATE endpoint, which is the "[u]nique url of the specific highlight (eg. a concrete tweet or a podcast snippet)".
If you're looking for the corresponding key in the response, it's "url": in the Highlights LIST endpoint and a few others.

And after asking for more clarification:

The "highlights_url": response (with an "s") is the link to the article/book/… in Readwise, similar to "readwise_url" in some other endpoints, such as Highlight EXPORT. I don't know why both exist, maybe it's a legacy thing [...], but I think it's fair to say that "highlights_url": = "readwise_url", depending on endpoint
The unique URL of a highlight will always be shown after "url": in the response (e.g., in the Highlights LIST or Highlight DETAIL endpoints)
These unique URL responses are often "null" and only exist for highlights that can have a unique URL, like tweets, podcast snippets, saved discord comments, or any highlight created in Reader. So yes, any highlight made in Reader will have the https://read.readwise.io/read/highlightID in the response after "url:"

from readwise-mirror.

tdnzr avatar tdnzr commented on June 30, 2024

As you can see above, I've tried to make pull requests based on the info from Discord. Once again apologies for making single-file pull requests.

from readwise-mirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.