Package: zlibrary
zlibraryUpdate: Zlibrary is back to clearnet in Hydra mode, see #11.Installpip install zlibraryExampleimportzlibraryimportasyncioasyncdefmain():lib=zlibrary.AsyncZlib()# zlibrary requires a singlelogin account in order to access the websiteawaitlib.login(email,password)# count: 10 results per setpaginator=awaitlib.search(q="biology",count=10)# fetching first result set (0 ... 10)first_set=awaitpaginator.next()# fetching next result set (10 ... 20)next_set=awaitpaginator.next()# get back to previous set (0 ... 10)prev_set=awaitpaginator.prev()# create a paginator of computer science with max count of 50paginator=awaitlib.search(q="computer science",count=50)# fetching results (0 ... 50)next_set=awaitpaginator.next()# calling another next_set will fire up a request to fetch the next pagenext_set=awaitpaginator.next()# get current result setcurrent_set=paginator.result# current_set = [#    {#         'id': '123',#         'isbn': '123',#         'url': 'https://x.x/book/123',#         'cover': 'https://x.x/2f.jpg',#         'name': 'Numerical Python',#         'publisher': 'No Fun Allowed LLC',#         'publisher_url': 'https://x.x/s/?q=NoFunAllowedLLC',#         'authors': [#             {#               'author': 'Ben Dover',#               'author_url': 'https://x.x/g/Ben_Dover'#             }#         ],#         'year': '2019',#         'language': 'english',#         'extension': 'PDF',#         'size': ' 23.46 MB',#         'rating': '5.0/5.0'#    },#    { 'id': '234', ... },#    { 'id': '456', ... },#    { 'id': '678', ... },# ]# switch pages explicitlyawaitpaginator.next_page()# here, no requests are being made: results are cachedawaitpaginator.prev_page()awaitpaginator.next_page()# retrieve specific book from listbook=awaitpaginator.result[0].fetch()# book = {#     'url': 'https://x.x/book/123',#     'name': 'Numerical Python',#     'cover': 'https://x.x/2f.jpg',#     'description': "Leverage the numerical and mathematical modules...",#     'year': '2019',#     'edition': '2',#     'publisher': 'No Fun Allowed LLC',#     'language': 'english',#     'categories': 'Computers - Computer Science',#     'categories_url': 'https://x.x/category/173/Computers-Computer-Science',#     'extension': 'PDF',#     'size': ' 23.46 MB',#     'rating': '5.0/5.0',#     'download_url': 'https://x.x/dl/123'# }if__name__=='__main__':asyncio.run(main())Search paramsfromzlibraryimportLanguage,Extensionawaitlib.search(q="Deleuze",from_year=1976,to_year=2005,lang=[Language.ENGLISH,Language.RUSSIAN],extensions=[Extension.PDF,Extension.EPUB])awaitlib.full_text_search(q="The circuits of surveillance cameras are themselves part of the decor of simulacra",lang=[Language.ENGLISH],extensions=[Extension.PDF],phrase=True,exact=True)Onion exampleYou need to enable onion domains and set up a tor proxy before you can use the library.importzlibraryimportasyncioasyncdefmain():lib=zlibrary.AsyncZlib(onion=True,proxy_list=['socks5://127.0.0.1:9050'])# 127.0.0.1:9050 is the default address:port of tor service# tor website cannot be accessed without loginawaitlib.login(email,password)# now you can use it as usualpaginator=awaitlib.search(q="biology",count=10)if__name__=='__main__':asyncio.run(main())Enable loggingPut anywhere in your code:importlogginglogging.getLogger("zlibrary").addHandler(logging.StreamHandler())logging.getLogger("zlibrary").setLevel(logging.DEBUG)Proxy support# You can add multiple proxies in the chain:# proxy_list=[#    "http://login:password@addr:port",#    "socks4://addr:port",#    "socks5://addr:port"# ]lib=zlibrary.AsyncZlib(proxy_list=["socks5://127.0.0.1:9050"])awaitlib.login(email,password)awaitlib.init()Download historyawaitlib.login(email,password)# get a paginator of download historydhistory=awaitlib.profile.download_history()# get current pagefirst_page=dhistory.result# get next page (if any; returns [] if empty)awaitdhistory.next_page()# go backawaitdhistory.prev_page()# fetch a bookbook=awaitdhistory.result[0].fetch()Download limitsawaitlib.login(email,password)limit=awaitlib.profile.get_limits()# limit = {'books': {'daily': '0/10', 'total': '13'}, 'articles': {'daily': '0/30', 'total': '0'}}Booklistsawaitlib.login(email,password)# get booklists paginatorbpage=awaitlib.profile.search_public_booklists(q="philosophy",count=10,order=zlibrary.OrderOptions.POPULAR)# get first 10 booklistsfirst_set=awaitbpage.next()# get one booklistbooklist=first_set[0]# get booklist databooklist_data=awaitbooklist.fetch()# booklist_data = { 'name': 'VVV', url: 'YYY' }# get first 10 books from the booklistbook_set=awaitbooklist.next()# fetch a bookbook=awaitbook_set[0].fetch()# fetch personal booklistsbpage=awaitlib.profile.search_private_booklists(q="")Set up a tor servicesudo apt install tor obfs4proxyoryay -S tor obfs4proxyfor Archsudo systemctl enable --now torIf tor is blocked in your country, you also need to edit /etc/tor/torrc and set up bridges for it to work properly.HOW TO REQUEST BRIDGESUsing gmail, send an email tobridges@torproject.orgwith the following content:get transport obfs4Shortly after you should receive a reply with bridges.Edit /etc/tor/torrc to enable and add your bridges:UseBridges 1
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
<INSERT YOUR BRIDGES HERE>Restart tor service:sudo systemctl restart tor