I won't get into the ethics or morals of copyright, DMCA, licensing, and so forth. I've held my opinions for decades, and I tire of rehashing them. I'll just share what I've been doing recently. You'll have to Duck for the links.
Calibre is a crazy awesome e-book swiss army knife utility. A user "apprenticeharper" has a "DeDRM_tools" repo on GitHub that includes a Wiki that has a lot of this info. This includes a plugin for Calibre to strip the DRM from books like the ones you get for Amazon Kindle.
When you "check out" an e-book from your library via Amazon Kindle, Amazon will "wrap" the book encryption keys with your own individual account keys. The De_DRM plugin uses your own individual account private key to unwrap the book key that then decrypts the book contents.
The Amazon Kindle PC and Mac apps store your private key to disk. I have Kindle reader version 1.17.0 (44170) installed on Win10, and under "Tools -> General" I have "Automatically install updates when they are available without asking me" unchecked. I found that version of the reader by searching online and downloading a mystery binary. The hash of the binary checked out with hashes I found posted in forums talking about it, so I'm not really that worried about the authenticity of it. If you're really concerned you can run all this in a VM, which probably wouldn't be a bad idea.
So after you "check out" the book via the library, the book will show up in your Amazon Kindle library. You can download it in the Kindle app. At that point the book that's "wrapped" with your account keys will be in a place like "Documents\My Kindle Content" as an .azw file.
After I installed the DeDRM plugin for Calibre I went to "Preferences -> Plugins -> DeDrm (7.2.1) by Apprentice Alf, ...." and double-clicked on it. Then I selected "Kindle for Mac/PC ebooks" and made sure "default_key" was present. Note that you can also "Import Existing Keyfiles," and at one point I had success using a Kindle device key (you have to download an .azw file from Amazon Kindle's web site that's wrapped with your device key for that to work). But the Kindle app is easiest for me.
"default_key" will cause the plugin to look for your on-disk keys in the usual location that the Kindle app drops them in your local filesystem. If you want to see the magic you can restart Calibre in debug mode (under the Preferences menu, or Ctrl+Shift+R). This will drop a log file from the plugin telling you what it's trying to do and why it might have problems finding your account private key.
Once the Calibre with DeDRM plugin is working and accessing my Kindle app account key, I can click-and-drag the .azw file in the "My Kindle Content" into Calibre, and Calibre will strip the DRM and store the e-book file under your "Calibre Library" directory.
You can then use the "Convert books" context menu for the book to export to EPUB or MOBI format. I use EPUB for my Kobo reader and MOBI for my Kindle reader.
Once you have it all set up, the process is pretty quick and straightforward. It takes me just a couple of minutes.
For the occasional Adobe Digital Editions e-book (.acsm file) I simply use the Adobe Digital Editions app to download and then grab the .epub file from the "Documents\My Digital Editions" directory.
For audiobooks, those are distributed as .odm files. I use the "overdrive.sh" script from chbrown's overdrive repo on GitHub to download the audio files, which get distributed without DRM. I wrote another script to combine the audio files into one big audio file because that's more convenient for me to work with. I use the BookPlayer app on my mobile device to listen to them.
I try to do all of this the same day my e-book becomes available for checkout so that I can return the e-book ASAP to help the next person waiting in the queue to get access to it.
Is this more legal than just pulling the book off of libgen? I knew someone in middle school who would rent movies from Redbox, rip them and then take them back, and I didn't understand why he wouldn't just torrent them to save the trip.
Calibre is a crazy awesome e-book swiss army knife utility. A user "apprenticeharper" has a "DeDRM_tools" repo on GitHub that includes a Wiki that has a lot of this info. This includes a plugin for Calibre to strip the DRM from books like the ones you get for Amazon Kindle.
When you "check out" an e-book from your library via Amazon Kindle, Amazon will "wrap" the book encryption keys with your own individual account keys. The De_DRM plugin uses your own individual account private key to unwrap the book key that then decrypts the book contents.
The Amazon Kindle PC and Mac apps store your private key to disk. I have Kindle reader version 1.17.0 (44170) installed on Win10, and under "Tools -> General" I have "Automatically install updates when they are available without asking me" unchecked. I found that version of the reader by searching online and downloading a mystery binary. The hash of the binary checked out with hashes I found posted in forums talking about it, so I'm not really that worried about the authenticity of it. If you're really concerned you can run all this in a VM, which probably wouldn't be a bad idea.
So after you "check out" the book via the library, the book will show up in your Amazon Kindle library. You can download it in the Kindle app. At that point the book that's "wrapped" with your account keys will be in a place like "Documents\My Kindle Content" as an .azw file.
After I installed the DeDRM plugin for Calibre I went to "Preferences -> Plugins -> DeDrm (7.2.1) by Apprentice Alf, ...." and double-clicked on it. Then I selected "Kindle for Mac/PC ebooks" and made sure "default_key" was present. Note that you can also "Import Existing Keyfiles," and at one point I had success using a Kindle device key (you have to download an .azw file from Amazon Kindle's web site that's wrapped with your device key for that to work). But the Kindle app is easiest for me.
"default_key" will cause the plugin to look for your on-disk keys in the usual location that the Kindle app drops them in your local filesystem. If you want to see the magic you can restart Calibre in debug mode (under the Preferences menu, or Ctrl+Shift+R). This will drop a log file from the plugin telling you what it's trying to do and why it might have problems finding your account private key.
Once the Calibre with DeDRM plugin is working and accessing my Kindle app account key, I can click-and-drag the .azw file in the "My Kindle Content" into Calibre, and Calibre will strip the DRM and store the e-book file under your "Calibre Library" directory.
You can then use the "Convert books" context menu for the book to export to EPUB or MOBI format. I use EPUB for my Kobo reader and MOBI for my Kindle reader.
Once you have it all set up, the process is pretty quick and straightforward. It takes me just a couple of minutes.
For the occasional Adobe Digital Editions e-book (.acsm file) I simply use the Adobe Digital Editions app to download and then grab the .epub file from the "Documents\My Digital Editions" directory.
For audiobooks, those are distributed as .odm files. I use the "overdrive.sh" script from chbrown's overdrive repo on GitHub to download the audio files, which get distributed without DRM. I wrote another script to combine the audio files into one big audio file because that's more convenient for me to work with. I use the BookPlayer app on my mobile device to listen to them.
I try to do all of this the same day my e-book becomes available for checkout so that I can return the e-book ASAP to help the next person waiting in the queue to get access to it.