data

package
v0.0.0-...-f2ba6e3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImdbData

type ImdbData struct {
	URL     string   `json:"url,omitempty" db:"url"`
	Title   string   `json:"title,omitempty" db:"title"`
	Year    int      `json:"year,omitempty" db:"year"`
	Rating  string   `json:"rating,omitempty" db:"rating"`
	Summary string   `json:"summary,omitempty" db:"summary"`
	Poster  string   `json:"poster,omitempty" db:"poster"`
	Links   []string `json:"-" db:"-"`
}

ImdbData contains data from a single page

func (ImdbData) GetKey

func (data ImdbData) GetKey() string

GetKey returns the model's key

func (data ImdbData) GetLinks() []string

GetLinks returns the model's parsed links

func (ImdbData) Parse

func (data ImdbData) Parse(body *io.ReadCloser, url string) (Parser, error)

Parse extracts IMDB specific data

type Parser

type Parser interface {
	GetKey() string     // Get the unique key
	GetLinks() []string // Get the list of links
	Parse(body *io.ReadCloser, url string) (Parser, error)
}

Parser is used to implement custom site-specific parsing logic. Each Parser has only 2 rules for the contents of the struct

  1. It should have some sort of unique string key
  2. It should collect a slice of links to visit from each page

Jump to

Keyboard shortcuts

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