animelayer

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

README

go-animelayer-parser

Go Reference Go Report Card Coverage Status tests integration

go-aninelayer-parser is a Go client library to parse torrents AnimeLayer.

Installation

This package can be installed using:

`go get github.com/dmji/go-animelayer-parser`

Usage

Import the package using:

import "github.com/dmji/go-animelayer-parser"

See package samples

Documentation

Overview

Code generated by "stringer -type=Category -trimprefix=Category -nametransform=snake_case_lower -fromstringgenfn -outputtransform=snake_case_lower"

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEmptyPage = errors.New("empty page")
)

Functions

func DefaultClientWithAuth added in v0.1.0

func DefaultClientWithAuth(cred Credentials) (*http.Client, error)

DefaultClientWithAuth - http.Client with auth to AnimeLayer

Types

type Category added in v0.0.3

type Category int8

Category - animelayer category

const (
	CategoryAnime Category = iota
	CategoryAnimeHentai
	CategoryManga
	CategoryMangaHentai
	CategoryMusic
	CategoryDorama
)

func CategoryFromString added in v0.1.2

func CategoryFromString(s string) (Category, error)

func (Category) MarshalJSON added in v0.1.3

func (i Category) MarshalJSON() ([]byte, error)

func (Category) Presentation added in v0.1.2

func (c Category) Presentation() string

func (Category) String added in v0.1.3

func (i Category) String() string

func (*Category) UnmarshalJSON added in v0.1.3

func (i *Category) UnmarshalJSON(data []byte) error

func (*Category) Url added in v0.1.2

func (c *Category) Url() string

type ClientWrapper added in v0.1.0

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

ClientWrapper - Default wrapper over http.Client

func NewClientWrapper added in v0.1.0

func NewClientWrapper(client *http.Client) *ClientWrapper

NewClientWrapper - Create default wrapper over http.Client

func (*ClientWrapper) Get added in v0.1.0

func (c *ClientWrapper) Get(utl string) (*html.Node, error)

Get - method implementation

type Credentials

type Credentials struct {
	Login    string
	Password string
}

Credentials - Animelayer data for loging request

type DocGetter added in v0.1.0

type DocGetter interface {
	Get(utl string) (*html.Node, error)
}

DocGetter - Interface for html loader

type Item added in v0.1.0

type Item struct {
	Identifier  string
	Title       string
	IsCompleted bool

	Metrics ItemMetrics
	Updated ItemUpdate

	RefImagePreview string
	RefImageCover   string

	Category Category

	Notes           string
	NotesSematizied *NotesSematizied
}

Item - main item of package

func (*Item) GetTorrentURL added in v0.1.0

func (m *Item) GetTorrentURL() string

GetTorrentURL - direct download link

type ItemMetrics added in v0.0.6

type ItemMetrics struct {
	Uploads         string
	Downloads       string
	FilesSize       string
	Author          string
	VisitorCounter  string
	ApprovedCounter string

	DebugReadFromElementClass string `json:"ReadFromHtmlKey"`
}

ItemMetrics - data from metrics block

type ItemProvider added in v0.1.0

type ItemProvider interface {
	GetItemByIdentifier(ctx context.Context, identifier string) (*Item, error)
	GetItemsFromCategoryPages(ctx context.Context, category Category, iPage int) ([]Item, error)
}

ItemProvider - interface of main package object

func New

func New(client DocGetter, ServiceOptionsApplier ...ServiceOptionsApplier) ItemProvider

New - create main package object

type ItemUpdate added in v0.0.6

type ItemUpdate struct {
	UpdatedDate          *time.Time
	CreatedDate          *time.Time
	SeedLastPresenceDate *time.Time

	DebugReadFromElementClass string `json:"ReadFromHtmlKey"`
}

ItemUpdate - data from update dates block

type NotesSematizied added in v0.1.2

type NotesSematizied struct {
	Taged   []NotesSematiziedItem `json:"Taged,omitempty"`
	Untaged []string              `json:"Untaged,omitempty"`
}

func (*NotesSematizied) Extend added in v0.1.2

func (n *NotesSematizied) Extend(from *NotesSematizied)

type NotesSematiziedItem added in v0.1.2

type NotesSematiziedItem struct {
	Tag    string           `json:"Tag"`
	Text   string           `json:"Text,omitempty"`
	Childs *NotesSematizied `json:"Childs,omitempty"`
}

type ServiceOptionsApplier added in v0.0.6

type ServiceOptionsApplier func(s *service)

ServiceOptionsApplier - type of options applier

func WithNoteClassOverride added in v0.0.6

func WithNoteClassOverride(noteElem, noteClass string) ServiceOptionsApplier

WithNoteClassOverride - Provide customize for notes elements, wrap plaint text into noteElem if need to specify class of elem add 'noteClass' as well else left empty

Directories

Path Synopsis
sample
get_target_item command

Jump to

Keyboard shortcuts

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