def download_file(url, filename): headers = {"User-Agent": "Audible/671 CFNetwork/1240.0.4 Darwin/20.6.0"} with httpx.stream("GET", url, headers=headers) as r: with open(filename, 'wb') as f: for chunck in r.iter_bytes(): f.write(chunck) return filename if __name__ == "__main__": password = input("Password for file: ") auth = audible.Authenticator.from_file(filename="FILENAME", password=password) client = audible.Client(auth) books = client.get(path="library", params={ "response_groups": "product_attrs", "num_results": "999" }) for book in books["items"]: asin = book["asin"] title = book["title"] + f"( {asin}).aaxc" lr = get_license_response(client, asin, quality="Extreme") if lr: # download book dl_link = get_download_link(lr)
auth = audible.Authenticator.from_login(credentials["username"], credentials["password"], locale="US", with_username=False) def get_wishlist_page(pageno, numresults): result = client.get("1.0/wishlist", num_results=numresults, page=pageno, response_groups="product_desc, product_attrs", sort_by="-DateAdded") return result["products"] with audible.Client(auth=auth) as client: output = {"library": [], "wishlist": []} library = client.get("1.0/library", num_results=1000, response_groups="product_desc, product_attrs", sort_by="-PurchaseDate") for book in library["items"]: print(book["title"]) output["library"].append(book["title"]) wishlist = [] wishlistpageidx = 0 numresults = 50