Python interface to Library Genesis.
Project description
Python interface to Library Genesis.
Currently only supports the libgen.io
mirror. Will need to write custom parsers for other mirrors in the future.
Installation
pylibgen can be installed via pip
:
python3 -m pip install pylibgen --user
Usage
>>> from pylibgen import Library
>>> lg = Library()
>>> ids = lg.search('automate the boring stuff', 'title')
>>> ids
['1421206', '1421207', '1421208', '1351717', '1381538', '1381540', '1529338']
>>> books = lg.lookup(ids)
>>> from pprint import pprint; pprint(books[0])
{'author': 'Albert Sweigart',
'edition': '',
'extension': 'epub',
'filesize': '4485769',
'identifier': '978-1593275990',
'md5': '054255117b2e86251415292ef48320fd',
'pages': '0',
'title': 'Automate the Boring Stuff with Python: Practical Programming for '
'Total Beginners',
'year': '2015'}
>>> lg.get_download_url(books[0]['md5'])
'http://libgen.io/get.php?md5=054255117b2e86251415292ef48320fd&key=NQTP585IPY102LYG'
Development Setup
Firstly, you’ll need pipenv
installed:
python3 -m pip install pipenv --user
To setup and enter the virtual environment for development:
pipenv install --dev && pipenv shell
Compatibility
pylibgen is tested to work with python 3.4 - 3.6.
Support Library Genesis!
Library.get_download_url
will by default parse the temporary download key from libgen’s ads.php redirect page. This is necessary for a valid direct download URL since libgen uses those temp keys to get more ad revenue.
If you want to support Library Genesis, I recommend passing enable_ads=True
to Library.get_download_url
. This will return the plain download URL, which shows an ad first when visited.
Disclaimer
Use this at your own risk. I am not responsible or liable for any piracy, copyright infringement, or other things committed by anyone using pylibgen. Blah blah lawyer stuff, etc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pylibgen-1.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9caf0405095be3709c5bf997e85498f02a50597e52888f9d136f8a0fc2137d6 |
|
MD5 | 6456c3861f323421d319560c29ed52d3 |
|
BLAKE2b-256 | 11260934cd92a5e8946cb9a99265790bf35de35a6201e87daaa836b8a0a641a2 |