tp86 / legimi-go

Unofficial Legimi ebook downloader for Kindle and Linux
MIT License
8 stars 0 forks source link

legimi-go list - no books listed #3

Open whoisnobody opened 4 months ago

whoisnobody commented 4 months ago

Hello, Despite the fact, that I have added books on the shelf in the legimi, when I use legimi-go list command, I don't receive any results. I have used your old legimi app written in lua and it worked perfectly, but now I experience the same issue in the lua and the go implementations.

tp86 commented 4 months ago

Hi,

See if you can download books. You can copy book id from its url, e.g. https://www.legimi.pl/ebook-problem-trzech-cial-liu-cixin,b173281.html has id 173281. Just click on any book on your shelf and copy its id.

Now, if you can download books, there is a chance that you're using older version of app, make sure you use latest version (at least 0.2.0). If you're using latest version, then there is probably a bug, I will need more time to investigate, especially that I'm on vacation right on.

If you can't download books, make sure you configured your account properly.

In any case, let me know what happens and if there is any output at all.

whoisnobody commented 4 months ago

I've tried that, without luck. I'm sure I've configured app correctly, because lua implementation worked before with the same configuration.

https ://www. legimi. pl/ polka /ebook-osci-ignacy-karpowicz,b127578.html

Old app:

lua legimi download 127578
src/flow.lua:58: attempt to index a nil value

New app (v0.2.1):

./legimi-go download 127578
Error while executing command: unexpected book metadata list count: 0, expected 1
tp86 commented 4 months ago

Hmmm, that's weird. Looks like it cannot find this book on your shelf. I assume that you have your subscription active?

whoisnobody commented 4 months ago

Yep, subscription is active.

tp86 commented 4 months ago

As a last resort, if you have access to Windows machine, you can check if official app works.

I think I had similar issue with Lua version and even official app didn't list or download any books. What helped was removing official app, removing its data directory (in AppData/Local, I think) and reinstalling it. I guess it may do some additional cleaning step which is not covered by my app. I thought I prevented this issue from occurring with Go version, but maybe mixing usage between Lua and Go versions messes this up. You can try it and see if after "resetting" with official app, listing with only Go version works.

That's all I can think of right now without access to my desktop.

73rrto4r commented 4 months ago

I had similar issue, where I wasn't able to see the list of files (return didn't seem to do anything). Deleting config.ini and setting it up resolved issue.

tp86 commented 4 months ago

Deleting config.ini (or using different config file path) and setting it up again may actually be quicker version of "resetting" I described above. Asking for device id given serial number might be the missing piece. I suggest trying that first as it is the easiest and fastest.

whoisnobody commented 4 months ago

Tried this, but nothing changed. Still the same problem.

tp86 commented 4 months ago

What about official app? Have you tried if it works?

whoisnobody commented 4 months ago

I have no access to the machine with Windows right now, so unfortunately I cannot check it.

tp86 commented 4 months ago

Unfortunately, I cannot reproduce the issue. I'll try later to prepare some version with debug options, but from my perspective everything works fine (I hate to say it).

At this point I can only advice to double-check your setup. For example, Kindle serial number should be written without spaces. I noticed that wrong serial number doesn't cause any error and returns some device id which doesn't work (causing the exact symptoms you've described). ~If your device id looks like 47079xx - that's the returned device ids I observe trying various (wrong) serial numbers - it's almost certainly wrong.~ OTOH, it may be just sequential numbers of registered devices.

EDIT: And, of course, all Legimi limits apply. You cannot add more (Kindle) devices than your subscription allows. Also, you should probably have your Kindle registered using official app. Registering Kindle using my app may work but it was not intended.

tp86 commented 3 months ago

One more thing you could check, however I don't know if it's going to be helpful: you can download your user data from Legimi web page (https://www.legimi.pl/konto/#) and check what's under "devices" and especially "Kindle" type ones. But I have several of those from my various attempts of registering dummy devices and it doesn't cause me any trouble

whoisnobody commented 3 months ago

I have two kindle devices there, tried with both of them (changing device id in your script) at the moment, and the same result, with empty list.

tp86 commented 3 months ago

At this point really the best option is to check if and how official Legimi application works. For me both Lua and Go versions "just work".

Just to be sure: you have registered your Kindle first time using official app? I don't know if it matters, but perhaps there is some extra step involved that my script just doesn't cover. I assume that you did that because it worked before.

BTW, is there anything that changed since it worked?

whoisnobody commented 3 months ago

I've registered kindle device using your lua script. I've been using it for a few months and it worked just fine. Every month I had a similar process of downloading books, so it looks like it just stopped working without any change on my side. When it stopped working I've moved to a go implementation, but as I mentioned before, I have the same result on it.

tp86 commented 3 months ago

Thanks for explanation - it's good to know that one doesn't need official app for registration.

I'll try to figure out why it's not working as expected, but it will be hard and probably take some time.

What bothers me is that it seems to work fine - there are no errors returned - it seems like from script perspective there are just no books no your shelf.

whoisnobody commented 3 months ago

Is there any simple API call request that I could test for example from postman, to check what is being returned from legimi, when requesting for book shelf?

tp86 commented 3 months ago

There are 2 problems with that:

  1. Protocol used by Legimi is binary - you don't get nice and readable JSON response. You have to interpret returned bytes yourself which is not easy.
  2. Before listing books, you have to request for session Id and extract it from response.

Manually preparing requests and interpreting responses is very tedious and error-prone, that's the reason I prepared the script.

I'm working on script version that will dump ~all communication as hex strings~ selected data from requests and responses, so it will be easier to debug, but it will be a risk of exposing sensitive information. I'll try to minimize it, though.

whoisnobody commented 3 months ago

I tried with the desktop app, and then with your script, and now it's listing my books on the shelf properly.

tp86 commented 3 months ago

That's great news!

I guess there are some extra maintenance steps that desktop app is performing that are not covered in my script.

I'll leave this issue open, so I can investigate and try to fix it when I have more time (and probably when something like that happens to me as well).