pixiv

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PixivLAppAPI = "https://api.lolicon.app/setu/v2"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRequest

type APIRequest struct {
	Num   int      `json:"num,omitempty"`
	Tags  []string `json:"tag,omitempty"`
	Size  []string `json:"size,omitempty"`
	Proxy string   `json:"proxy,omitempty"`
	R18   int      `json:"r18"`
}

type APIResponse

type APIResponse struct {
	Error string          `json:"error"`
	Data  []SinglePicture `json:"data"`
}

type OmegaPixivIllusts

type OmegaPixivIllusts struct {
	ID        int       `gorm:"column:id;primaryKey"`
	PID       int64     `gorm:"column:pid;uniqueIndex:ix_omega_pixiv_illusts_pid"`
	UID       int64     `gorm:"column:uid"`
	Title     string    `gorm:"column:title"`
	Uname     string    `gorm:"column:uname"`
	NsfwTag   int       `gorm:"column:nsfw_tag"` //nsfw标签, 0=safe, 1=setu, 2=r18
	Width     int       `gorm:"column:width"`
	Height    int       `gorm:"column:height"`
	Tags      string    `gorm:"column:tags;size:1024"`
	URL       string    `gorm:"column:url;size:1024"`
	CreatedAt time.Time `gorm:"column:created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at"`
}

OmegaPixivIllusts Omega图库结构,请从https://github.com/Ailitonia/omega-miya/raw/master/archive_data/db_pixiv.7z手动导入数据库 特别鸣谢Ailitonia/omega-miya项目

func (OmegaPixivIllusts) TableName

func (p OmegaPixivIllusts) TableName() string

type PictureGetter

type PictureGetter func(tags []string, num int, isR18 bool) []PictureInfo

type PictureInfo

type PictureInfo struct {
	Title string // 标题

	// 下载所需
	URL string // 图片链接
	PID int64  // 下载图片时要么有URL;要么有PID及P
	P   int    // 分P

	// 描述所需
	Tags   []string // 标签
	Author string   // 作者
	UID    int64    // 作者UID

	Src string // 无需填写,来源图库
}

func GetRandomPictures added in v0.3.0

func GetRandomPictures(tags []string, least int, r18 bool) []PictureInfo

GetRandomPictures 获取至少least张随机涩图,但也可能为空

func (PictureInfo) CheckNoSESE added in v0.2.1

func (pic PictureInfo) CheckNoSESE() bool

CheckNoSESE 不可以涩涩检查,为true时才可以进行下一步

func (*PictureInfo) GenSinglePicMsg

func (pic *PictureInfo) GenSinglePicMsg() (message.Message, error)

GenSinglePicMsg 生成单条Pixiv消息

func (*PictureInfo) GetDescribe added in v0.1.2

func (pic *PictureInfo) GetDescribe() string

GetDescribe 获取图片说明

func (*PictureInfo) GetPicture added in v0.2.3

func (pic *PictureInfo) GetPicture() (path string, err error)

GetPicture 下载图片,返回图片保存路径

func (*PictureInfo) GetURLByPID

func (pic *PictureInfo) GetURLByPID() (err error)

GetURLByPID 通过PID获取图片下载URL

func (*PictureInfo) ReplaceURLToProxy added in v0.1.2

func (pic *PictureInfo) ReplaceURLToProxy()

ReplaceURLToProxy 将图片URL替换为反代地址

type SinglePicture

type SinglePicture struct {
	Pid        int64             `json:"pid"`
	P          int               `json:"p"`
	Uid        int64             `json:"uid"`
	Title      string            `json:"title"`
	Author     string            `json:"author"`
	R18        bool              `json:"r18"`
	Width      int               `json:"width"`
	Height     int               `json:"height"`
	Tags       []string          `json:"tags"`
	Ext        string            `json:"ext"`
	UploadDate int               `json:"uploadDate"`
	Urls       map[string]string `json:"urls"`
}

Jump to

Keyboard shortcuts

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