gvellut / jncep

Command-line tool to generate EPUB files for J-Novel Club pre-pub novels
GNU General Public License v3.0
43 stars 11 forks source link

401 Client Error: Unauthorized for url: https://labs.j-novel.club/app/v1/auth/login?format=json #50

Closed AnAngryBrit closed 4 months ago

AnAngryBrit commented 4 months ago

Describe the bug When manually fetching a part with jncep epub a 401 error is returned

Expected behavior Running the command should download the 15th volume of Campfire Cooking in Another World with My Absurd Skill

To Reproduce jncep --debug epub 13 -p 15

Option: EMAIL => a*@g***.com Option: PASSWORD => Option: OUTPUT => /share/Multimedia/Books/jncep/ Option: BYVOLUME => true Option: USE_EVENTS => true Option: WHOLE => true Option: SUBFOLDER => true

Debug trace

2024-06-11 21:42:18,538 jncep.utils  INFO     Resolve to series '[highlight]Campfire Cooking in Another World with My Absurd Skill'[/]
2024-06-11 21:42:18,538 jncep.utils  WARNING  Login with email '[highlight]a*****************@g****.com[/]'...
2024-06-11 21:42:19,049 jncep.utils  ERROR    *** An unrecoverable error occured ***
2024-06-11 21:42:19,049 jncep.utils  ERROR    401 Client Error: Unauthorized for url: https://labs.j-novel.club/app/v1/auth/login?format=json
2024-06-11 21:42:19,054 jncep.cli    DEBUG    Traceback (most recent call last):
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/cli/base.py", line 17, in invoke
    return super().invoke(ctx)
   File "/usr/lib/python3/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
   File "/usr/lib/python3/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/trio_utils.py", line 31, in wrapper
    return trio.run(partial(f, *args, **kwargs))
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/trio/_core/_run.py", line 1932, in run
    raise runner.main_task_outcome.error
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/cli/epub.py", line 82, in generate_epub
    async with core.JNCEPSession(email, password) as session:
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/core.py", line 71, in __aenter__
    await self.login(self.email, self.password)
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/core.py", line 103, in login
    token = await self.api.login(email, password)
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/jncep/jnclabs.py", line 151, in login
    r.raise_for_status()
   File "/home/AnAngryBrit/.local/lib/python3.10/site-packages/asks/response_objects.py", line 47, in raise_for_status
    raise BadStatus(
 asks.errors.BadStatus: 401 Client Error: Unauthorized for url: https://labs.j-novel.club/app/v1/auth/login?format=json
gvellut commented 4 months ago

I think the issue is with the command itself: jncep --debug epub 13 -p 15

The last option should be: -s 15

The -p option is for the password so in the first command, 15 is sent as the password to JNC. The -s option (or --parts) is for the volume / part.

AnAngryBrit commented 4 months ago

yep that would do it, my drive filled up and cause my scheduled update to fail so i am now having to go back and download the parts i missed. because i cannot work out how to reset the last update date to a week before when using the events feed.

gvellut commented 3 months ago

OK.

It is probably too late now, but something you could do in that case is manually edit the tracked.json file inside the configuration folder. Then change the part_date fields for all the series (if you use the --use-events option, you should change the last_check_date field as well) and set it to a date before your disk filled up.