gnhentai

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2020 License: MIT Imports: 6 Imported by: 0

README

gnhentai

gnhentai — nhentai.net parser for Go.


Getting Started

This library is packaged using Go modules. You can get it via:

go get github.com/tdakkota/gnhentai

Use as app

Install and run (GOBIN should be int PATH)

gnhentai-cli download 

or

gnhentai-cli download --id=<your_manga_id>

Documentation

Index

Constants

View Source
const BaseNHentaiLink = "https://nhentai.net"

Variables

This section is empty.

Functions

func DownloadAll

func DownloadAll(downloader Downloader, d Doujinshi, namer func(i int, d Doujinshi) string) error

Types

type Client

type Client interface {
	ByID(id int) (Doujinshi, error)
	Random() (Doujinshi, error)

	Search(q string, page int) ([]Doujinshi, error)
	SearchByTag(tag Tag, page int) ([]Doujinshi, error)
	Related(id int) ([]Doujinshi, error)
}

type Cover

type Cover = Image

type Doujinshi

type Doujinshi struct {
	// ID is unique identification number of Doujinshi.
	// Note: parser does not parse ID of Doujinshi.
	ID        int    `json:"id"`
	MediaID   int    `json:"media_id"`
	Title     Title  `json:"title"`
	Tags      []Tag  `json:"tags"`
	Scanlator string `json:"scanlator"`
	// NumPages is number of manga pages.
	NumPages     int       `json:"num_pages"`
	NumFavorites int       `json:"num_favorites"`
	UploadDate   time.Time `json:"upload_date"`
	Images       Images    `json:"images"`
}

func (*Doujinshi) UnmarshalJSON

func (d *Doujinshi) UnmarshalJSON(data []byte) error

type Downloader

type Downloader interface {
	Page(mediaID, n int) (io.ReadCloser, error)
	Thumbnail(mediaID int, n int) (io.ReadCloser, error)
	Cover(mediaID int) (io.ReadCloser, error)
}

type Image

type Image struct {
	T      string `json:"t"`
	Width  int    `json:"w"`
	Height int    `json:"h"`
}

type Images

type Images struct {
	Pages     []Page    `json:"pages"`
	Cover     Cover     `json:"cover"`
	Thumbnail Thumbnail `json:"thumbnail"`
}

type JSONTimestamp

type JSONTimestamp struct {
	time.Time
}

JSONTimestamp

func (*JSONTimestamp) UnmarshalJSON

func (t *JSONTimestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON parses json number into time.Time

type Page

type Page = Image

type Tag

type Tag struct {
	ID    int    `json:"id"`
	Type  string `json:"type"`
	Name  string `json:"name"`
	URL   string `json:"url"`
	Count int    `json:"count"`
}

type Thumbnail

type Thumbnail = Image

type Title

type Title struct {
	English  string `json:"english"`
	Japanese string `json:"japanese"`
	Pretty   string `json:"pretty"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL