pill

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 9 Imported by: 1

README

Pill 💊

Go Reference Go Report Card License

Pill is a parser utilized to grab illustration information from Pixiv, yande.re, and Konachan.

Pixiv Illustration information contains:

  • Illustration Title
  • Description
  • Tags
  • Creation Date & Time (represent in format of unix timestamp)
  • Picture URLs
  • Author Information
    • Pixiv Member ID
    • Name
    • Avatar URL

Others are various. More details can be found in GoDoc.

Example

package main

import (
	"encoding/json"
	"fmt"
	"github.com/YKMeIz/Pill"
)

func main() {
	res, err := pill.Pixiv("66917712")

	if err != nil {
		panic(err)
	}

	b, err := json.Marshal(res)

	if err != nil {
		panic(err)
	}

	fmt.Println(string(b))
}

The output, in a pretty and human readable JSON format, would be:

{
  "title": "コード:002",
  "id": "66917712",
  "description": "Line drawings converted by exist images.線画は既存の画像で変換されます。",
  "tags": [
    "Code:002",
    "線画"
  ],
  "created_at": 1516617934,
  "sources": [
    "https://i.pximg.net/img-original/img/2018/01/22/19/45/34/66917712_p0.png",
    "https://i.pximg.net/img-original/img/2018/01/22/19/45/34/66917712_p1.png"
  ],
  "author": {
    "id": "16412800",
    "name": "90榣",
    "avatar": "https://i.pximg.net/user-profile/img/2018/01/22/19/30/01/13726842_b73c069f1a20efc265f12c2693fea41d_50.png"
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KonachanInfo

type KonachanInfo danbooruBase

KonachanInfo describes the details of a post on konachan.com.

func Konachan

func Konachan(id string) (KonachanInfo, error)

Konachan returns the parsed details of a Konachan.com post.

type PixivInfo

type PixivInfo struct {
	// Title is illustration title.
	Title string `json:"title"`
	// ID is illustration ID. It comes from url query value of "illust_id".
	ID string `json:"id"`
	// Description is the description texts from illustration page.
	Description string `json:"description"`
	// Tags is the array of tags that illustration has.
	Tags []string `json:"tags"`
	// CreatedAt is unix timestamp of the illustration creation date time.
	CreatedAt int64 `json:"created_at"`
	// Sources is urls of pictures uploaded under the illustration.
	// It is an array because a illustration page may contain multiple pictures.
	Sources []string `json:"sources"`
	// Author is the author of the illustration.
	Author PixivMember `json:"author"`
}

PixivInfo describes the details of a Pixiv illustration work.

func Pixiv

func Pixiv(id string) (PixivInfo, error)

Pixiv returns the parsed details of a Pixiv illustration work.

type PixivMember

type PixivMember struct {
	// ID is the Pixiv member ID.
	ID string `json:"id"`
	// Name is the Pixiv member name.
	Name string `json:"name"`
	// Avatar is url of the Pixiv member avatar.
	Avatar string `json:"avatar"`
}

PixivMember describes the details of a Pixiv member (author).

type YandeInfo

type YandeInfo danbooruBase

YandeInfo describes the details of a post on yande.re.

func Yande

func Yande(id string) (YandeInfo, error)

Yande returns the parsed details of a Yande.re post.

Jump to

Keyboard shortcuts

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