scribd-downloader icon indicating copy to clipboard operation
scribd-downloader copied to clipboard

fontfaces error

Open KeePach opened this issue 2 years ago • 8 comments

when trying to download it goes to "loading viewer" and after a little bit it stops with this error: "waiting for locator("#fontfaces")"

Capture

KeePach avatar Jan 14 '23 20:01 KeePach

I can successfully download the example given in the instructions https://www.scribd.com/book/322011391/The-Subtle-Art-of-Not-Giving-a-F-ck-A-Counterintuitive-Approach-to-Living-a-Good-Life

However, I am getting an error with a different URL

python3 ~/Desktop/run.py https://www.scribd.com/book/436275554/InterActions-Performing-Actual-and-Virtual-Spaces-as-Stages-of-Inter-est Logged in successfully. Loading viewer... Traceback (most recent call last): File "/Users/userxyz/Desktop/run.py", line 58, in font_style = page.locator('#fontfaces').inner_html() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/sync_api/_generated.py", line 16747, in inner_html self._sync(self._impl_obj.inner_html(timeout=timeout)) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_sync_base.py", line 104, in _sync return task.result() ^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_locator.py", line 386, in inner_html return await self._frame.inner_html( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_frame.py", line 615, in inner_html return await self._channel.send("innerHTML", locals_to_params(locals())) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 44, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call return await cb() ^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 79, in inner_send result = next(iter(done)).result() ^^^^^^^^^^^^^^^^^^^^^^^^^ playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.

oceanswish avatar Jan 29 '23 16:01 oceanswish

It looks like there's a completely separate viewer for some of the files. Here's a screenshot showing the source if it can help:

image (based on this book https://www.scribd.com/read/479274378/Hamilton-An-American-Musical)

dan-nunes avatar Feb 27 '23 02:02 dan-nunes

Update: I have a workaround but it's not pretty and I'm not sure if it'll work in all cases. Add ?mode=standard to the URL to force the single-page view, commenting out lines 61-66. Hard-code font-style to this:

font_style="""@font-face { font-family: scala-sans-sc-offc-pro--; src: url('https://fonts.scribdassets.com/epub/default/20170705/scala-sans-sc-offc-pro--.ttf?token=1677516601_e76117a32c0e4f8bd46ef859da83165f0944f710') format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: scala-sans-offc-pro--; src: url('https://fonts.scribdassets.com/epub/default/20170705/scala-sans-offc-pro--.ttf?token=1677516601_2b40a62e97c0622d742ba728b3b72eb2ddda04f3') format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: scala-sans-offc-pro-i-; src: url('https://fonts.scribdassets.com/epub/default/20170705/scala-sans-offc-pro-i-.ttf?token=1677516601_c3fc49efb5ac049e05b506dbd0abcd22d5da71a5') format('truetype'); font-weight: normal; font-style: italic; } @font-face { font-family: scala-sans-offc-pro-bi-; src: url('https://fonts.scribdassets.com/epub/default/20170705/scala-sans-offc-pro-bi-.ttf?token=1677516601_195cd8c9db49a1860e542633120de3876f33cab7') format('truetype'); font-weight: bold; font-style: italic; } @font-face { font-family: scala-sans-offc-pro-b-; src: url('https://fonts.scribdassets.com/epub/default/20170705/scala-sans-offc-pro-b-.ttf?token=1677516601_99a0420ad8892541e762982bb0c5ae4177477574') format('truetype'); font-weight: bold; font-style: normal; }"""

dan-nunes avatar Feb 27 '23 21:02 dan-nunes

Seems some pages don't have <style id="fontfaces">, try to remove font render.

SIKtt avatar Aug 04 '23 15:08 SIKtt

Building and clarifying on what else has been posted here, I was able to download a book which presented the same error by:

  1. Comment out or delete lines 57 - 66 of run.py (retrieve fonts, open display menu, change to vertical mode)
  2. Insert @dan-nunes code from the Feb 27 post above before line 14
  3. Add ?mode=standard to the end of the URL you wish to download

Worked for me! Thanks to all who have contributed here.

BillShepp avatar Sep 19 '23 20:09 BillShepp

Building and clarifying on what else has been posted here, I was able to download a book which presented the same error by:

  1. Comment out or delete lines 57 - 66 of run.py (retrieve fonts, open display menu, change to vertical mode)
  2. Insert @dan-nunes code from the Feb 27 post above before line 14
  3. Add ?mode=standard to the end of the URL you wish to download

Worked for me! Thanks to all who have contributed here.

just did this but i get a

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect

can you provide your run.py for me? this only happens after adding the ?mode=standard

SkinnySkelly avatar Oct 03 '23 17:10 SkinnySkelly

Building and clarifying on what else has been posted here, I was able to download a book which presented the same error by:

  1. Comment out or delete lines 57 - 66 of run.py (retrieve fonts, open display menu, change to vertical mode)
  2. Insert @dan-nunes code from the Feb 27 post above before line 14
  3. Add ?mode=standard to the end of the URL you wish to download

Worked for me! Thanks to all who have contributed here.

just did this but i get a

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect

can you provide your run.py for me? this only happens after adding the ?mode=standard

You need a "\" before the "?mode". It got deleted from my post. So step 3 should be:

  1. Add "\?mode=standard" (no quotes) to the end of the URL you wish to download

BillShepp avatar Oct 03 '23 21:10 BillShepp

Building and clarifying on what else has been posted here, I was able to download a book which presented the same error by:

  1. Comment out or delete lines 57 - 66 of run.py (retrieve fonts, open display menu, change to vertical mode)
  2. Insert @dan-nunes code from the Feb 27 post above before line 14
  3. Add ?mode=standard to the end of the URL you wish to download

Worked for me! Thanks to all who have contributed here.

just did this but i get a OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect can you provide your run.py for me? this only happens after adding the ?mode=standard

You need a "" before the "?mode". It got deleted from my post. So step 3 should be:

  1. Add "?mode=standard" (no quotes) to the end of the URL you wish to download

worked great. grabbed about 50 of them. only a few are still not working returning this error:

waiting for locator("div.vertical_page[data-page="0"]") to be visible

i thought maybe i could try the orginal run.py but that returns the old fontfaces error.

SkinnySkelly avatar Oct 04 '23 16:10 SkinnySkelly