Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fontfaces error #6

Open
KeePach opened this issue Jan 14, 2023 · 8 comments
Open

fontfaces error #6

KeePach opened this issue Jan 14, 2023 · 8 comments

Comments

@KeePach
Copy link

KeePach commented Jan 14, 2023

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

Capture

@oceanswish
Copy link

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.

@dan-nunes
Copy link

dan-nunes commented Feb 27, 2023

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
Copy link

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;
}"""

@SIKtt
Copy link

SIKtt commented Aug 4, 2023

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

@BillShepp
Copy link

BillShepp commented Sep 19, 2023

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.

@SkinnySkelly
Copy link

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

@BillShepp
Copy link

BillShepp commented Oct 3, 2023

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

@SkinnySkelly
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@BillShepp @dan-nunes @KeePach @SIKtt @SkinnySkelly @oceanswish and others