animelayer

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 13 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

Index

Constants

This section is empty.

Variables

View Source
var Categories = categories{}

Categories - object to emulate enum class

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 string

Category - animelayer category

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

	Notes string
}

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 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