Giter Club home page Giter Club logo

Comments (9)

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

I was trying to download an ebook.

from odmpy.

ping avatar ping commented on June 11, 2024

I may have missed out on a dependency. Can you run the pip install command below, and then retry the download again?

python3 -m pip install lxml

from odmpy.

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

On it!

from odmpy.

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

Alright, so don't think I had the dependency you just mentioned, but I got a different error this time. Here is the whole cmd output:

C:\Users\titus\Desktop\Libby>odmpy libby --ebook --direct
odmpy Interactive Client for Libby

Found 5 loans.
1: The Third Wheel 🎧 Jeff Kinney
* Expires: 2023-04-20 Johnson County Library and Olathe Public Library
2: The Long Haul 🎧 Jeff Kinney
* Expires: 2023-04-20 Johnson County Library and Olathe Public Library
3: Cabin Fever 🎧 Jeff Kinney
* Expires: 2023-04-24 Johnson County Library and Olathe Public Library
4: Physics for Game Developers 📕 David M Bourg
* Expires: 2023-05-04 Johnson County Library and Olathe Public Library
5: Diary of a Wimpy Kid 🎧 Jeff Kinney
* Expires: 2023-05-04 Johnson County Library and Olathe Public Library

Download. Choose from 1-5 (separate choices with a space or leave blank to quit),
then press enter: 4
Opening ebook "Physics for Game Developers"...
Downloading apa.html: 0%| | 0/274 [00:00<?, ?it/s]
An unexpected error has occurred
Traceback (most recent call last):
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\odm.py", line 1079, in run
extract_loan_file(libby_client, selected_loan, args)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\odm.py", line 366, in extract_loan_file
process_ebook_loan(
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\processing\ebook.py", line 519, in process_ebook_loan
soup = BeautifulSoup(res.text, features="html.parser")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init_.py", line 228, in init
self.feed()
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 289, in feed
self.builder.feed(self.markup)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\builder_htmlparser.py", line 167, in feed
parser.feed(markup)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 110, in feed
self.goahead(0)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 178, in goahead
k = self.parse_html_declaration(i)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 269, in parse_html_declaration
self.handle_decl(rawdata[i+2:gtpos])
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\builder_htmlparser.py", line 112, in handle_decl
self.soup.endData(Doctype)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 365, in endData
self.object_was_parsed(o)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init_.py", line 370, in object_was_parsed
previous_element = most_recent_element or self._most_recent_element
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1040, in getattr
return self.find(tag)
^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1278, in find
l = self.find_all(name, attrs, recursive, text, 1, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1299, in find_all
return self._find_all(name, attrs, text, limit, generator, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 528, in find_all
strainer = SoupStrainer(name, attrs, text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1596, in init
self.text = self.normalize_search_value(text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1601, in normalize_search_value
if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match')
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
Traceback (most recent call last):
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Scripts\odmpy-script.py", line 33, in
sys.exit(load_entry_point('odmpy==0.7.6', 'console_scripts', 'odmpy')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy_main
.py", line 27, in main
run()
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\odm.py", line 1079, in run
extract_loan_file(libby_client, selected_loan, args)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\odm.py", line 366, in extract_loan_file
process_ebook_loan(
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\odmpy\processing\ebook.py", line 519, in process_ebook_loan
soup = BeautifulSoup(res.text, features="html.parser")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 228, in init
self.feed()
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 289, in feed
self.builder.feed(self.markup)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\builder_htmlparser.py", line 167, in feed
parser.feed(markup)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 110, in feed
self.goahead(0)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 178, in goahead
k = self.parse_html_declaration(i)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\html\parser.py", line 269, in parse_html_declaration
self.handle_decl(rawdata[i+2:gtpos])
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\builder_htmlparser.py", line 112, in handle_decl
self.soup.endData(Doctype)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 365, in endData
self.object_was_parsed(o)
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4_init
.py", line 370, in object_was_parsed
previous_element = most_recent_element or self._most_recent_element
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1040, in getattr
return self.find(tag)
^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1278, in find
l = self.find_all(name, attrs, recursive, text, 1, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1299, in find_all
return self._find_all(name, attrs, text, limit, generator, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 528, in _find_all
strainer = SoupStrainer(name, attrs, text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1596, in init
self.text = self._normalize_search_value(text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\titus\AppData\Local\Programs\Python\Python311\Lib\site-packages\bs4\element.py", line 1601, in _normalize_search_value
if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match')
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'

from odmpy.

ping avatar ping commented on June 11, 2024

It looks like you have a very old version of a dependency. Please upgrade it and then try again.

python3 -m pip install beautifulsoup4 --upgrade

from odmpy.

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

Okay

from odmpy.

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

This is the version it updated to: Successfully installed beautifulsoup4-4.12.2

from odmpy.

PAGMAYouTube avatar PAGMAYouTube commented on June 11, 2024

It worked! I have one more question. Can you make the program automatically turn it into a pdf. I was reading the docs, but I got really confused about the file system. Then when I looked it up it said you could do --direct pdf to get a pdf. It didn't work. If I can't turn it into a pdf straight from the program that's fine. Thanks.

from odmpy.

ping avatar ping commented on June 11, 2024

You misread. Only books available in the "Open PDF" format can be downloaded as a pdf.

eBooks

Experimental Feature

Using the --ebooks option will allow you to download/return/renew EPUB/PDF eBook loans. Information about the different eBook formats available can be found here.

For EPUB/PDF DRM loans, odmpy will download an .acsm file for use with Adobe Digital Editions (ADE) by default.

For loans available as an "Open EPUB" or "Open PDF", the actual DRM-free .epub/.pdf book file will be downloaded. There is no option to download the .acsm file for open formats.

The --direct option

Using the --direct option with EPUB DRM loans will download the web Libby version of the eBook as an .epub. This is different from the .epub that you get when you use an .acsm loan file with ADE.

This option is not recommended because the .epub downloaded may not work well with your reader. Use this as an alternative if you cannot use the .acsm file for whatever reason.

The --direct option does not affect PDF eBook loans. These will continue to be downloaded as .acsm or .pdf.

from odmpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.