Code Monkey home page Code Monkey logo

libhandler's Introduction

LibHandler

This is a simple WIP C# LibGen Library that uses Web scraping and the "official" API to search and download books.
Since this Library is still in early development I cannot guarantee a bug-free experience.
Please note that if the LibGen API or Website changes at any point, this Library might break.
The maintainers of the different LibGen Mirrors might limit your traffic or block you altogether if you misuse this Library.
USE AT YOUR OWN RISK!

Supported Features

Feature Description Status
Books JSON Get JSON Book Data of the provided IDs. ๐ŸŸข Works
Multiple Mirrors Use the optimal Mirror for searching and downloading. ๐ŸŸข Works
Search (Title, Author, ...) Search for books with certain filters ๐ŸŸก Works, but hasn't been tested with all filters yet
Downloads Download books ๐ŸŸก Works, but only with the MD5 Hash of the book

Usage / Example

Get IDs of the first 25 Books that have ".NET" in their title

string request = LibraryHandler.GetRequestFormat(SearchField.Title, ".NET", 25);
List<string> ids = LibraryHandler.GetIDs(request);

Get JSON Data of books with the provided IDs

string request = LibraryHandler.GetRequestFormat(SearchField.Title, ".NET", 25);
List<string> ids = LibraryHandler.GetIDs(request);
string json = LibraryHandler.GetJSONData(ids);
// List<Book> books = JsonConvert.DeserializeObject<List<Book>>(json);

Combined Version (This is the recommended way)

string request = LibraryHandler.GetRequestFormat(SearchField.Title, ".NET", 25);
List<Book> books = LibraryHandler.GetBooks(request);

Download Book

string download = LibraryHandler.GetDownloadLinkByMD5(books[0].md5);
// OR
string download = LibraryHandler.GetDownloadLink(books[0]);

Additional Functions

// Gets the current Mirror (The Search and Download Mirror are seperate)
Mirror mirror = LibraryHandler.GetCurrentMirror(MirrorType.SearchMirror);
// Sets the current Mirror
Mirror mirror = new Mirror()
{
    Url = "libgen.is",
    FullUrl = "https://libgen.is",
    MirrorType = MirrorType.SearchMirror,
};

Mirror downloadMirror = new Mirror()
{
    Url = "library.lol",
    FullUrl = "http://library.lol",
    MirrorType = MirrorType.DownloadMirror,
    Path = "/main/"
};

LibraryHandler.SetCurrentMirror(mirror);
LibraryHandler.SetCurrentMirror(downloadMirror);

Mirrors can also be added in the mirrors.json file

License

Copyright (C) 2024 ncrypted-dev

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

libhandler's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.