RussCoder / djvujs

DjVu.js is a program library for working with .djvu files online without any connection with the server. DjVu.js Viewer is a widget that allows viewing .djvu files right in the browser and can be easily embedded into any web page.
https://djvu.js.org/
Other
184 stars 37 forks source link

feature_request(sites): LibGen/Z-Library support #22

Closed Kristinita closed 4 years ago

Kristinita commented 4 years ago

1. Summary

It would be nice, if DjVu.js will open remote DjVu files from LibGen and Z-Library like PDF.js opens PDF's from this resources.

2. Note

If you in Russian Federation, АнтиЗапрет or its alternatives may be required for opening links from this issue.

3. Argumentation

Z-Library is the world largest free ebook library. Nowadays (24.11.2019) it contains 4891894 books. Most of thousand books from my collection I was getting from Z-Library. Also, use LibGen search, I can find books in similar big libraries — LibGen, Lib.rus.ec and BookFI.

For details, you can read my instruction about getting free ebooks (in Russian).

4. Steps to reproduce

For example, I want to read Nikolay Zelenevsky's book about dogs anatomy.

I make search request to LibGen → I click, for example, to number 4:

Number 4

Get links → I click to, for example, https://openlib.xyzget item.

  1. Expected behavior — I clicked to PDF link (see image above)
  2. Unexpected behavior — to DjVu link

5. Expected behavior

PDF.js (by default in Firefox):

PDF.js

File successfully opened in browser. Direct links to specific pages as https://d-m.freelib.xyz/get_item/5c63f84150b42539789d0624#page=14 also works.

6. Unexpected behavior

DjVu.js, option Open all .djvu links via the viewer is activated:

DjVu.js

File doesn't open in DjVu.js Viewer.

Thanks.

RussCoder commented 4 years ago

@Kristinita @r-pankevicius

In the version 0.3.6.0 (already available for Firefox, will be available for Chrome after the review) I have added the support of http headers analysis for djvu detection. It's enabled via a corresponding option on the initial screen of the viewer.

I process 3 cases:

The last one is needed for some sites which do not add the Content-Type headers. However there are other forms of Content-Disposition and they are not covered. If you find a site where it doesn't work, create a new issue.