semvec/pypi-packages huggingface dataset:
kitsune-nh 0.0.7
nhentai.net API wrapper for doujins
Keywords: python,wrapper,scraper,nhentai,anime,manga

[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)
# Kitsune

An asynchronous nhentai.net API wrapper and scraper

As of now the wrapper has most of the functionality the API has to offer, except for the endpoint for filtering galleries by tag which I didn't include in the wrapper due to the fact that the search endpoint can already do that. The only thing left to do is to improve the quality of the code, implement GIF downloading which, according to how they are distributed across nhentai image repositories, will be quite troublesome and writing the documentation. 

Only contributions I allow will be accepted. This will be worked on only in my free time. 

### Current capabilities: 

- nhentai.net API endpoints data requesting 
- Searching and filtering with webscraping
- Ratelimit handling
- Downloading done via threads

### Pre-release: 

- Extra polishing, some extra refactoring and last touches.
- Licensing, uploading the package and guide on how to use.

### Post-release: 
- GIF downloading support.
- Even more refactoring. 
- Tweaks and changes for the http handler.

## Installation

Python 3.8+

```
pip install kitsune-nh
```

## How-to-use guide

The main way to instantiate the wrapper class is via an async context manager which takes care of creating and closing the HTTP session internally.

```py
import asyncio

from kitsune import Kitsune

async def main():
    async with Kitsune() as client: 
        ...
    
```

You can also opt to pass your own HTTP session.

```py
import aiohttp

from kitsune import Kitsune

async def main():

    session = aiohttp.ClientSession()
    
    async with Kitsune.from_session(session) as client: 
        ...
   
```

Now that you have your instance of the wrapper, using it is fairly simple. Some examples below.

```py
import aiohttp

from kitsune import Kitsune, Popularity, Tag, Artist, Character, Parody, Group 

async def main():
    async with Kitsune(loop = your_loop) as client: # Passing your own loop 
    
    	# Wrapper methods
        
        gallery = await client.fetch_gallery(312781)
        
        galleries = await client.fetch_galleries([312781, 31286, 9294])
        
        related = await client.fetch_related(312781)
        
        random_gallery = await client.fetch_random()
        
        comments = await client.fetch_comments(gallery.id)
        
        homepage = await client.fetch_homepage()
        
        shelf = await client.search(Tag["kitsune"], popularity = Popularity.ALL_TIME)
        
        await client.download(shelf, "/home/acertig/Pictures")
     
```
More examples and explanations can be found on the documentation. 

Special thanks to hentai-chan for sharing the API endpoints. They were necessary for this async version of the wrapper to work. 
You can check his own sync wrapper here: https://github.com/hentai-chan/hentai
TrieCLI 0.0.2
A command line interface implmenting the trie data structure
Requires Python: >=3.2

# trie_project CLI
SLINGSHOT take home project submission


## Demo Video

***maybe?***

<!-- ABOUT THE PROJECT -->
## About The Project

Using the Trie data structure to create a usable command line interface with various commands such as add, remove, and search by prefix. I used figlet for a nice looking interface, I used flask and requests to implement the cli with the global state. Lastly I used PythonAnywhere to host the whole thing.

A list of commands are as follows:

    help:                        shows all commands available through the cli
    add_[words]:                 adds words or a word to the trie
    remove_[words]:              deletes words or a word from the trie
    search_[words]:              searches for the words or word in the trie and returns words found and not found
    visualize:                   displays all items currently in the trie
    searchbyprefix_[prefix]:     returns all items in the trie starting with the given prefix

Here are some resources I used to build this project:

* [Wikipedia Article for a Trie](https://en.wikipedia.org/wiki/Trie)
* [Medium Article on Understand Tries](https://medium.com/basecs/trying-to-understand-tries-3ec6bede0014)
* [GeeksForGeeks Implementation(no code copied)](https://www.geeksforgeeks.org/trie-insert-and-search/)


### Built With

* [Flask](https://flask.palletsprojects.com/)
* [Requests](https://docs.python-requests.org/)
* [PyFiglet](http://www.figlet.org/)
* [PythonAnywhere](https://https://www.pythonanywhere.com/)


<!-- GETTING STARTED -->
## Getting Started

* *Clone git repository*
* *Make sure correct packages are installed(Prerequisites)*
* *Run server.py* using ```python server.py``` inside triecli

Example run:
![](https://user-images.githubusercontent.com/36611240/138568591-3eb0883a-a874-4dbb-b2b9-545c535b6578.png)
![](https://user-images.githubusercontent.com/36611240/138568606-1ba74026-76e1-4a46-a9d1-281714dee749.png)
![](https://user-images.githubusercontent.com/36611240/138568673-68af66f5-7539-4285-8e38-e7d6a631474a.png)

If you would like to run elsewhere change the link at line 49 in server.py and make sure you have the files: trie1.py, app.py, server.py


### Prerequisites

This is an example of how to list things you need to use the software and how to install them.
* flask
  ```pip install flask```
* pyfiglet
  ```pip install pyfiglet```
* requests
  ```pip install requests```
* Make sure you have python 3
<!-- LICENSE -->
## License
Distributed under the MIT License. See `LICENSE` for more information.
<!-- CONTACT -->
## Contact
Nalin Nagar - nalinnagar1@gmail.com