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

Add --captcha login option for when pyperclip doesnt work #99

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It doesn't work with audiobooks and is a little harder to set up, but I think it

This is a hard fork of [kobo-book-downloader](https://github.com/TnS-hun/kobo-book-downloader), a command line tool to download and remove Digital Rights Management (DRM) protection from media legally purchased from [Rakuten Kobo](https://www.kobo.com/). The resulting [EPUB](https://en.wikipedia.org/wiki/EPUB) files can be read with, amongst others, [KOReader](https://github.com/koreader/koreader).

> **NOTE:** You must have a kobo email login for this tool to work (you can't use an external provider like Google or Facebook). However, you can create a NEW kobo account and link it with your existing account on the user profile page. Go to `My Account -> Account Settings` to link your new kobo login.
> **NOTE:** You must have a kobo email login. See "I can't log in" in the troubleshooting section for how to workaround this requirement.

## Features

Expand Down Expand Up @@ -228,6 +228,18 @@ You must add your CalibreWeb server and user details directly in kobodl.json. M

## Troubleshooting

> I can't log in. My credentials are rejected.

You must have a kobo email login for this tool to work (you can't use an external provider like Google or Facebook). However, you can create a NEW kobo account and link it with your existing account on the user profile page. Go to `My Account -> Account Settings` to link your new kobo login.

> I can't log in. I get a message saying "The page format might have changed"

This happens from time to time, maybe once or twice a year. Kobo changes their login page and makes it hard for the tool to parse out the necessary information. Please open an issue.

> I can't log in, there's a problem with reading the captcha

The clipboard interaction doesn't work for everyone. Try supplying the captcha using `koobdl user add --captch "YOUR_CAPTCHA_CODE"`.

> Some of my books are missing!

Try `kobodl book list --read` to show all "finished" and "archived" books. You can manage your book status on [the library page](https://kobo.com/library). Try changing the status using the "..." button.
Expand All @@ -236,10 +248,6 @@ Try `kobodl book list --read` to show all "finished" and "archived" books. You

Try to download the book individually using `kobodl book get <revision-id>`, replacing `revision-id` with the UUID from the list table.

> I can't log in. I get a message saying "The page format might have changed"

This happens from time to time, maybe once or twice a year. Kobo changes their login page and makes it hard for the tool to parse out the necessary information. Please open an issue.

> Something else is going wrong!

Try enabling debugging. Run `kobodl --debug book get` (for example), which will dump a lot of data into a file called `debug.log`. Email me this file. Do not post it in public on an issue because it will contain information about your account. My email address can be found on my [github profile page](https://github.com/subdavis).
Expand Down
10 changes: 6 additions & 4 deletions kobodl/commands/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def list(ctx, identifier):

@user.command(name='add', help='add new user')
@click.option('--email', prompt=True, hide_input=False, type=click.STRING, help="kobo.com email.")
@click.option('--captcha', type=click.STRING, help="kobo.com captcha.")
@click.password_option(help="kobo.com password (not stored)")
@click.pass_obj
def add(ctx, email, password):
def add(ctx, email, captcha, password):
user = User(Email=email)
click.echo(
"""
Expand All @@ -72,9 +73,10 @@ def add(ctx, email, password):
and paste it here. It will be very long!
"""
)
input('Press enter after copying the captcha code...')
captcha = pyperclip.paste().strip()
click.echo(f'Read captcha code from clipboard: {captcha}')
if not captcha:
input('Press enter after copying the captcha code...')
captcha = pyperclip.paste().strip()
click.echo(f'Read captcha code from clipboard: {captcha}')
actions.Login(user, password, captcha)
Globals.Settings.UserList.users.append(user)
Globals.Settings.Save()
Expand Down