gedoor / legado

Legado 3.0 Book Reader with powerful controls & full functions❤️阅读3.0, 阅读是一款可以自定义来源阅读网络内容的工具,为广大网络文学爱好者提供一种方便、快捷舒适的试读体验。
GNU General Public License v3.0
27.63k stars 3.73k forks source link

Possibility to use opds catalogues #2935

Closed Rorschach1010 closed 1 year ago

Rorschach1010 commented 1 year ago

I have a calibre server and a calibre Web Server running. Both can be reached via the opds API.

Legado doesn't seem to be able to connect to opds. I tried the "add url" option but it says error. Then I tried the source management. Seems like I can login through WebView inside legado but I couldn't download my books directly into legado.

Am I doing something wrong or is it not possible right now?

Xwite commented 1 year ago

legado only supports http protocol. Writing proper rules may be work for cailbre web.

Rorschach1010 commented 1 year ago

Since I don't have a domain and don't use a reverse proxy, I use only the http protocol. So technically it should work.

The thing is, I can login within the app but I can't download the books so that the book is in my legado library with all the tags (author, series, Publisher...).

Most of the in-app help is only in Chinese so I'm not sure if I'm missing something. Is there an English guide or wiki somewhere?

Xwite commented 1 year ago

Do yoy know CSS selector Xpath JsonPath? legado use them to get elements from http response. use @ to extract text from elements.


<div class="bookList>
  <div class="book">
    <div class="name">BookName</div>
    ...
  </div>
  <div class="book">
  ...
</div>

.bookList extract all book elements .name@text extract its innerText BookName

{
"books": [
    {"name": "bookName"},
  ...
 ]
}

$.books[*] all bookItem $.name bookItem name bookName

I do not know how cailbreWeb server response looks like. So may be i can help if you show me the response throw network tab of browser devtools. Or you just do it.

{
  "bookSourceName": "CailbreWeb",
  "bookSourceType": 0,
  "bookSourceUrl": "<protocol>://<your server ip>",
  "customOrder": 0,
  "enabled": true,
  "enabledCookieJar": true,
  "enabledExplore": true,
  "enabledReview": false,
  "lastUpdateTime": 0,
  "respondTime": 180000,
  "ruleBookInfo": {},
  "ruleContent": {},
  "ruleExplore": {},
  "ruleReview": {},
  "ruleSearch": {
    "bookList": "selector which can extract book elements",
    "name": "selector which can extract bookName"
  },
  "ruleToc": {},
  "searchUrl": "<searchEntry>, {\n  \"body\": \"${key}\",\n  \"method\": \"POST\",\n}",
  "weight": 0
}
Xwite commented 1 year ago

if you want to download file from server set source type to File downloadUrlRule extract file download urls