Skip to main content

pylibgen

PyPI Travis CI License MIT

Python interface to Library Genesis. Only the LibGen/Sci-Tech database is supported.

This project is largely unmaintained as of the 2.0.2 release. I am willing to make or accept pull requests for small maintenance releases if they are trivial, but any changes required due to major/breaking changes with libgen's internals will not be implemented.

Installation

pylibgen is well-tested on Python 3.6 - 3.7, and can be installed via pip install pylibgen.

Usage

>>> from pylibgen import Library
>>> l = Library()
>>> ids = l.search('stallman essays')
>>> ids
['112887', '310297', '688326', '1594161', '1610379']
>>> book1, book2, *_ = l.lookup(ids)
>>> book1.__dict__
{'id': '112887', 'title': 'Free software, free society: selected essays of Richard M. Stallman', 'author': 'Richard M. Stallman, Lawrence Lessig, Joshua Gay, Laurence Lessig', 'year': '2002', 'edition': 'First Printing, First Edition', 'pages': '230', 'identifier': '9781882114986,1882114981', 'extension': 'pdf', 'filesize': '2210323', 'md5': '861C055B960E7F36D95164CAB34E0E97'}
>>> book2.__dict__
{'id': '310297', 'title': 'Free Software Free Society: Selected Essays of Richard Stallman', 'author': 'Richard Stallman', 'year': '2010', 'edition': '2nd Edition', 'pages': '278', 'identifier': '0983159203,9780983159209', 'extension': 'pdf', 'filesize': '1597349', 'md5': '6C3C2593BBB5D77154D50DFDDC0EA669'}
>>> book1.get_url(filehost='b-ok.org')
'http://b-ok.org/md5/861C055B960E7F36D95164CAB34E0E97'

Support Library Genesis!

Book.get_url(filehost='...') will return the standard filehost gateway url.

There is no functionality to bypass any intermediate advertisement pages, and this behavior is intended because Library Genesis is a service worth supporting.

Development Setup

You'll need python 3.6, python 3.7, and tox. It's recommended to use pyenv to install + manage python versions and executable modules. An example:

$ pyenv install 3.6.8
$ pyenv install 3.7.3
$ pyenv global 3.7.3 3.6.8  # puts both pyenv-managed python3.6 and python3.7 on the PATH for tox
$ python3.7 -m pip install tox  # python will be resolved to 3.7.3 by pyenv's shim, this is just being explicit

To run pre-commit hooks and tests for all supported python versions (make sure you're not in a virtualenv before running this):

$ tox

To enter the version-specific virtualenv created above (you'll need this to commit with pre-commit hooks):

$ source .tox/py37/bin/activate

To only create the tox virtualenvs without running any (test) commands:

$ tox --notest

Disclaimer

Use pylibgen responsibly and at your own risk. The author(s) are not responsible or liable for any piracy, copyright infringement, or other offences committed by anyone using this software. Please consider supporting your favorite authors by purchasing their works!

Release files for pylibgen 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylibgen 2.0.2
File Size Uploaded
pylibgen-2.0.2.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylibgen 2.0.2
File Interpreter ABI Platform
pylibgen-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / pylibgen-2.0.2.tar.gz

Download URL pylibgen-2.0.2.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
87b28a27fa7c1912e2b38020262dd6086b292d670b0c08d76baecbcd7678b9ee
BLAKE2b-256 checksum
How to use checksums
2f3d585420be7b4bece996dcbb505ed87d94b61875b36033e738d0c3293a324e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

Release files / pylibgen-2.0.2-py3-none-any.whl

Download URL pylibgen-2.0.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb0a0bac8f2f7192958a2e7f913c67645d7f76231ff4f38f20ff44071dd28204
BLAKE2b-256 checksum
How to use checksums
67d5e31dcc2132575317f92fc4335f62eef72c377da4f98d94fd74f25bfb4c2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.3.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page