A free/libre interface for solving reCAPTCHA challenges.
Project description
Version 0.6.2
librecaptcha is a free/libre program and library that allows you to solve reCAPTCHA challenges.
librecaptcha does not automatically solve challenges and is not designed to make it easier to do so—it provides an interface through which a human can solve the challenges without proprietary software.
Installation
From PyPI
Install with pip:
sudo pip3 install librecaptcha[gtk]
To install locally, run without sudo and add the --user option. You can omit [gtk] if you don’t want to install the GTK 3 GUI.
From the Git repository
Clone the repository with the following commands (you’ll need to have Git installed):
git clone https://github.com/nickolas360/librecaptcha cd librecaptcha
Then install with pip:
sudo pip3 install .[gtk]
To install locally, run without sudo and add the --user option. You can omit [gtk] if you don’t want to install the GTK 3 GUI.
Run without installing
Run the first set of commands in the previous section to clone the repository. Then, install the required dependencies by running:
sudo pip3 install -r requirements.txt
To install the dependencies locally, run without sudo and add --user.
Usage
If you installed librecaptcha, you can simply run librecaptcha. Otherwise, run ./librecaptcha.py. Pass the --help option to show usage information. If you’d like to use the GUI, be sure to pass the --gui option.
To use librecaptcha programmatically, import it:
import librecaptcha
and then call librecaptcha.get_token(). Its signature is:
get_token( api_key: str, site_url: str, user_agent: str, *, gui=False, debug=False, ) -> str
Parameters:
api_key: The reCAPTCHA API key to use. This is usually the value of the data-sitekey HTML attribute.
site_url: The base URL of the site that contains the reCAPTCHA challenge. This should start with http:// or https:// and include the hostname. Everything after the hostname is optional. For example: https://example.com
user_agent: The user-agent string to use. This should match the user-agent used when sending the request that requires a reCAPTCHA token. You can generate a random user-agent string with librecaptcha.random_user_agent().
gui: Whether to use the GTK 3 GUI (as opposed to the CLI). The CLI writes to standard output and reads from standard input.
debug: Whether to print debug information.
Returns: A reCAPTCHA token. This should usually be submitted with the form as the value of the g-recaptcha-response field. These tokens usually expire after a couple of minutes.
Notes
librecaptcha currently supports two types of challenges: dynamic and multicaptcha.
dynamic challenges present you with a grid of different images and ask you to select the images that match the given description. Each time you click an image, a new one takes its place. Usually, three images from the initial set match the description, and at least one of the replacement images does as well.
multicaptcha challenges present you with one large image split into a grid of tiles and ask you to select the tiles that contain a given object. Occasionally, the image will not contain the object, but rather something that looks similar. It is possible to select no tiles in this case, but reCAPTCHA may have been fooled by the similar-looking object and would reject a selection of no tiles.
Note: Even when all challenges are completed and a token is obtained, the token may still be rejected when used. If this happens, simply try again. Waiting a while may also help. Unfortunately, you may have to try many times—perhaps even ten.
What’s new
Version 0.6.0:
Added librecaptcha.has_gui(), which returns whether the GUI can be used.
Improved cross-platform support for the CLI.
Version 0.5.0:
Added a GTK 3 GUI (thanks, cyclopsian!).
get_token() now has an optional gui parameter.
get_token() now requires a user-agent string.
librecaptcha.py now has a --gui option.
librecaptcha.py now accepts an optional <user-agent> argument. If not provided, a random user-agent string is chosen and shown.
Version 0.4.0:
Image windows are now automatically closed when questions are answered.
Version 0.3.x:
Fixed possible encoding issue in setup.py.
librecaptcha can now be installed from PyPI, or from the Git repository with pip or setup.py.
Version 0.2.x:
Updated user-agent list.
The current reCAPTCHA version is now fetched during initialization and no longer needs to be manually updated.
Dependencies
License
librecaptcha is licensed under the GNU General Public License, version 3 or any later version. See LICENSE.
This README file has been released to the public domain using CC0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file librecaptcha-0.6.2.tar.gz
.
File metadata
- Download URL: librecaptcha-0.6.2.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4d38a880fb8d0d80ba789a296fdc984658f7c3fcfcd271d76c05cbbce9cbab0 |
|
MD5 | 62b824b24b593b707104427a3c3285bf |
|
BLAKE2b-256 | 04e5b98c34d9aa0570906b7469c4d173688614dbd5f5e4a2b184510d9e65c2ce |
File details
Details for the file librecaptcha-0.6.2-py3-none-any.whl
.
File metadata
- Download URL: librecaptcha-0.6.2-py3-none-any.whl
- Upload date:
- Size: 36.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa78197f3867e9e0067b545ecf1013f653b181de35201aa5a44644451bf5e843 |
|
MD5 | bd10bc869e22a5cde05d6bf1a8f0dc94 |
|
BLAKE2b-256 | 59897c3786fef8c780c610ba46750617b6872216a814af591b9a99c3c81fda98 |