Package: py-apple-books
PyAppleBooksPyAppleBooks is a Python library designed to streamline interactions with Apple Books data. It offers a straightforward and intuitive interface, empowering developers to effortlessly access, manipulate, and manage Apple Books content through Python-based applications.Installationpip install py_apple_booksGetting Started - ExamplesHere are some basic examples of how to use PyAppleBooksUsing PyAppleBooksfrompy_apple_booksimportPyAppleBooksapi=PyAppleBooks()Get list of all booksbooks=api.list_books()forbookinbooks:print('-'*50)print(f"Title:{book.title}")print(f"Author:{book.author}")# Sample output
--------------------------------------------------
Title: Think & Grow Rich
Author: Napoleon Hill
--------------------------------------------------
Title: Autobiography of a Yogi (Complete Edition)
Author: Paramahansa Yogananda
--------------------------------------------------
Title: Sapiens
Author: Yuval Noah HarariGet a list of books along with their highlightsbooks_with_highlights=api.list_books(include_annotations=True)forbookinbooks_with_highlights:print('-'*50)print(f"Title:{book.title}")print(f"Author:{book.author}")print("Annotations:")forannotationinbook.highlights:print(f"\t{annotation.selected_text}")ifannotation.note:print(f"\tNote:{annotation.note}")# Sample output
--------------------------------------------------
Title: Elon Musk
Author: Walter Isaacson
Annotations:
        Adversity shaped me
        The people who are crazy enough to think they can change the world are the ones who do.

        They’re always trying to save the world, with their underpants on the outside or these skin-tight iron suits, which is really pretty strange when you think about it,
        Reading remained Musk’s psychological retreat. Sometimes he would immerse himself in books all afternoon and most of the night, nine hours at a stretch. When the family went to someone’s house, he would disappear into their host’s library. When they went into town, he would wander off and later be found at a bookstore, sitting on the floor, in his own world.
        Elon developed into a night person, staying up until dawn reading books
        One unfortunate trend in the 1980s was that cars and computers became tightly sealed appliances. It was possible to open up and fiddle with the innards of the Apple II that Steve Wozniak designed in the late 1970s, but you couldn’t do that with the Macintosh, which Steve Jobs in 1984 made almost impossible to open.Get a list of collections along with bookscollections=api.list_collections(include_books=True)forcollectionincollections:print('-'*50)print(f"Collection:{collection.title}")print(f"Books in collection:{len(collection.books)}")forbookincollection.books:print(f"\t{book.title}")# Sample output
--------------------------------------------------
Collection: Management
Books in collection: 1
        Crucial Conversations
--------------------------------------------------
Collection: Finance
Books in collection: 2
        TheBusinessofthe21stCenturyBook-FirstFiveChapters
        The Richest Man in Babylon
--------------------------------------------------
Collection: biography
Books in collection: 1
        Elon MuskGet list of all books by authorbooks=api.get_books_by_author('Robert C. Martin')forbookinbooks:print('-'*50)print(f"Title:{book.title}")print(f"Author:{book.author}")--------------------------------------------------
Title: Clean Code
Author: Robert C. Martin
--------------------------------------------------
Title: The Clean Coder
Author: Robert C. MartinGet all notesnotes=api.get_all_notes()fornoteinnotes:print('-'*50)print(f'Selected text:{note.selected_text}')print(f'Note text:{note.note}')# sample output
--------------------------------------------------
Selected text: profusion
Note text: Plethora
--------------------------------------------------
Selected text: As multi-leader replication is a somewhat retrofitted feature in many databases, there are often
subtle configuration pitfalls and surprising interactions with other database features. For example,
autoincrementing keys, triggers, and integrity constraints can be problematic. For this reason,
multi-leader replication is often considered dangerous territory that should be avoided if possible
Note text: Retrofitted = add on
--------------------------------------------------
Selected text: By subtracting a follower’s current position from the leader’s
current position, you can measure the amount of replication lag.
Note text: Calculate lag for leader based replication.Find all green highlightsnotes=api.get_annotation_by_color('green')fornoteinnotes:print('-'*50)print(f'Selected text:{note.selected_text}')print(f'Color:{note.color}')# sample output
--------------------------------------------------
Selected text: The purpose of life is a life of purpose
Color: green
--------------------------------------------------
Selected text: No man is free who is not a master of himself.'
Color: green
--------------------------------------------------
Selected text: The only limits on your life are those that you set yourself.
Color: greenContributionThank you for considering contributing to this project! Your help is greatly appreciated.To contribute to this project, please follow these guidelines:Opening IssuesIf you encounter a bug, have a feature request, or want to discuss something related to the project, please open an issue on the GitHub repository. When opening an issue, please provide:Bug Reports: Describe the issue in detail. Include steps to reproduce the bug if possible, along with any error messages or screenshots.Feature Requests: Clearly explain the new feature you'd like to see added to the project. Provide context on why this feature would be beneficial.General Discussions: Feel free to start discussions on broader topics related to the project.Contributing1️⃣ Fork the GitHub repositoryhttps://github.com/vgnshiyer/py-apple-books2️⃣ Create a new branch for your changes (git checkout -b feature/my-new-feature).3️⃣ Make your changes and test them thoroughly.4️⃣ Push your changes and open a Pull Request tomain.Please provide a clear title and description of your changes.LicensePyAppleBooks is licensed under the MIT license. See the LICENSE file for details.