ehclient

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: MIT Imports: 17 Imported by: 0

README

ehclient

ehclient is a Golang API client library for e-hentai.org, built with goquery.

Changelog

  • v0.1.0: Initial release

Documentation

Index

Constants

View Source
const (
	Doujinshi Category = 2
	Manga              = 4
	ArtistCG           = 8
	GameCG             = 16
	Western            = 512
	NonH               = 256
	ImageSet           = 32
	Cosplay            = 64
	AsianPorn          = 128
	Misc               = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category int

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opt *ClientOptions) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) GetGallery

func (c *Client) GetGallery(id int, token string, opt *GetGalleryOption) (*GalleryDetail, error)

func (*Client) GetPage

func (c *Client) GetPage(id int, page int, token string, opt *GetPageOptions) (*Page, error)

func (*Client) GetUserProfile

func (c *Client) GetUserProfile(userId int) (*UserProfile, error)

func (*Client) LoginWithCookie

func (c *Client) LoginWithCookie(memberId string, hashPass string) (*UserProfile, error)

func (*Client) SearchGalleries

func (c *Client) SearchGalleries(opt *SearchGalleriesOption) (*GalleryCursor, error)

type ClientOptions

type ClientOptions struct {
	Endpoint      Endpoint
	CookieExpires time.Duration
	UserAgent     string
}

type Endpoint

type Endpoint string
var (
	EhEndpoint Endpoint = "e-hentai.org"
	ExEndpoint Endpoint = "exhentai.org"
)

type GalleryComment

type GalleryComment struct {
	PostedAt     time.Time
	LastEditedAt *time.Time
	User         string
	Score        int
	Content      []*html.Node
}

type GalleryCursor

type GalleryCursor struct {
	Kind     PreviewKind
	Prev     string
	Next     string
	Previews []*GalleryPreview
}

type GalleryDetail

type GalleryDetail struct {
	Id         int
	Token      string
	Thumb      string
	Title      string
	TitleJpn   string
	Category   Category
	Uploader   string
	PostedAt   time.Time
	Parent     *IdTokenPair
	Visible    string
	Language   string
	FileSize   string
	Pages      int
	Favoriteds int
	Rating     float64
	Rateds     int
	Tags       []*TagGroup
	Versions   []*GalleryVersion
	Previews   []*PagePreview
	Comments   []*GalleryComment
}

type GalleryPreview

type GalleryPreview struct {
	Id         int
	Token      string
	Thumb      string
	Title      string
	Category   Category
	PostedAt   time.Time
	Rating     float64
	Uploader   string
	Pages      int
	HasTorrent bool
	Tags       []*TagGroup
}

type GalleryVersion

type GalleryVersion struct {
	Id      int
	Token   string
	Title   string
	AddedAt time.Time
}

type GetGalleryOption

type GetGalleryOption struct {
	PreviewPage       int
	WithHiddenComment bool
}

type GetPageOptions

type GetPageOptions struct {
	ApiToken    string
	ReloadToken string
}

type HttpError

type HttpError struct {
	StatusCode int
	Status     string
	Body       string
	Err        error
}

func (*HttpError) Error

func (e *HttpError) Error() string

type IdTokenPair

type IdTokenPair struct {
	Id    int
	Token string
}

type Page

type Page struct {
	Page        int
	Token       string
	FileName    string
	Url         string
	RawUrl      string
	Prev        *PageTokenPair
	Next        *PageTokenPair
	ReloadToken string
	ApiToken    string
}

type PagePreview

type PagePreview struct {
	Page     int
	Token    string
	FileName string
	Thumb    string
	Width    int
	Height   int
	Offset   int
}

type PageTokenPair

type PageTokenPair struct {
	Page  int
	Token string
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

func (*Parser) Matcher

func (p *Parser) Matcher(sel string) goquery.Matcher

func (*Parser) Single

func (p *Parser) Single(sel string) goquery.Matcher

type ParserNotFoundError

type ParserNotFoundError struct {
	Module string
	Node   string
	Attr   string
}

func (*ParserNotFoundError) Error

func (e *ParserNotFoundError) Error() string

type ParserParseError

type ParserParseError struct {
	Module   string
	Field    string
	RawValue string
	Reason   error
}

func (*ParserParseError) Error

func (e *ParserParseError) Error() string

type PreviewKind

type PreviewKind string
var (
	Minimal     PreviewKind = "m"
	MinimalPlus PreviewKind = "p"
	Compact     PreviewKind = "l"
	Extended    PreviewKind = "e"
	Thumbnail   PreviewKind = "t"
)

type SearchGalleriesOption

type SearchGalleriesOption struct {
	Keywords                      string
	Categories                    int
	IncludeExpunged               bool
	MustHaveTorrent               bool
	PagesRangeStart               int
	PagesRangeEnd                 int
	MinimunRating                 int
	DisableCustomFilterOfLanguage bool
	DisableCustomFilterOfUploader bool
	DisableCustomFilterOfTags     bool
	PreviewKind                   PreviewKind
	Next                          int

	RawQuery string
}

type TagGroup

type TagGroup struct {
	Namespace string
	Values    []*TagValue
}

type TagValue

type TagValue struct {
	Value  string
	IsWeak bool
}

type UserProfile

type UserProfile struct {
	DisplayName string
	Avatar      string
}

Jump to

Keyboard shortcuts

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