-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Description
I'm suspicious that the export_highlight
function is not giving me all my highlights.
I ran it recently and only received 82 total notes in Apple Notes. I have way more than that...
I think it has something to do with the generator or the API wrapper I'm using.
def export_highlights(
updated_after: str = None, book_ids: str = None, token: str = None
) -> Generator[dict, None, None]:
"""Exports the highlights of books based on modification date and/or specific book IDs.
This function iterates over pages of highlights fetched from the client service,
filtering by update time and book IDs if provided, and yields each highlight.
Parameters:
updated_after (str, optional): The ISO 8601 date string to filter highlights
that were updated after a certain date. Defaults to None.
book_ids (str, optional): A comma-separated string of book IDs to filter
highlights by specific books. Defaults to None.
token (str): A Readwise API token. Default to None.
Yields:
dict: A dictionary representing a single book's highlight.
"""
client = get_client(token)
params = {}
if updated_after:
params["updatedAfter"] = updated_after
if book_ids:
params["ids"] = book_ids
for data in client.get_pagination_limit_20("/export/", params=params):
for book in data["results"]:
yield book
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested