exhentai

package module
v0.0.0-...-94e23f9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: MIT Imports: 12 Imported by: 0

README

exhentai-go

Example

package main

import (
	"encoding/json"
	"fmt"

	exhentai "github.com/tensei/exhentai-go"
)

func main() {
	exhentai, err := exhentai.NewClient()
	if err != nil {
		fmt.Println(err)
	}
  	// ipb_member_id and ipb_pass_hash from exhentai site cookies
	err = exhentai.Login("xxxxx", "xxxxx")
	if err != nil {
		fmt.Println(err)
	}

	// the gallery you want do download
	gallery := "https://exhentai.org/g/{GalleryID}/{GalleryToken}/"
	
	metadata, err := exhentai.Metadata(gallery)
	if err != nil {
		fmt.Println(err)
	}

	ms, err := json.MarshalIndent(metadata, "", "\t")
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(ms)

	err = exhentai.Download(gallery, "/save/path")
	fmt.Println(err)
}

Documentation

Index

Constants

View Source
const (
	// DefaultRatelimit default ratelimit for downloading pictures
	DefaultRatelimit = time.Second / 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Gmetadata []struct {
		ArchiverKey  string   `json:"archiver_key"`
		Category     string   `json:"category"`
		Expunged     bool     `json:"expunged"`
		Filecount    string   `json:"filecount"`
		Filesize     int      `json:"filesize"`
		Gid          int      `json:"gid"`
		Posted       string   `json:"posted"`
		Rating       string   `json:"rating"`
		Tags         []string `json:"tags"`
		Thumb        string   `json:"thumb"`
		Title        string   `json:"title"`
		TitleJpn     string   `json:"title_jpn"`
		Token        string   `json:"token"`
		Torrentcount string   `json:"torrentcount"`
		Uploader     string   `json:"uploader"`
	} `json:"gmetadata"`
}

APIResponse metadata api response

type Exhentai

type Exhentai struct {
	Ratelimit time.Duration
	// contains filtered or unexported fields
}

Exhentai client storing everything

func NewClient

func NewClient() (*Exhentai, error)

NewClient creates a client for handling everything

func (*Exhentai) Download

func (ex *Exhentai) Download(gallery, savepath string) error

Download download the gallery to the save path given

func (*Exhentai) Login

func (ex *Exhentai) Login(memberid, passhash string) (bool, error)

Login login using your ipb_member_id and ipb_pass_hash cookie

func (*Exhentai) Metadata

func (ex *Exhentai) Metadata(url string) (APIResponse, error)

Metadata returns the metadata for the given url

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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