Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
529 B
3
Indexable
Never
import subprocess

def remove_kindle_drm(input_file, output_file):
    # Use the Calibre ebook-convert command to remove DRM and convert the e-book to Kindle format
    command = ["ebook-convert", input_file, output_file, "--output-profile=kindle", "--unencrypted-metadata=opf", "--no-default-epub-cover"]

    # Run the command and capture the output
    result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    # Print the output
    print(result.stdout.decode())
    print(result.stderr.decode())