api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiBaseUri = "https://archive.ragtag.moe"
)

Variables

View Source
var (
	None              = SortBy{""}
	ArchivedTimestamp = SortBy{"archived_timestamp"}
	UploadDate        = SortBy{"upload_date"}
	Duration          = SortBy{"duration"}
	ViewCount         = SortBy{"view_count"}
	LikeCount         = SortBy{"like_count"}
	DislikeCount      = SortBy{"dislike_count"}
)
View Source
var (
	Ascending  = SortOrder{"asc"}
	Descending = SortOrder{"desc"}
)

Functions

func ApiChannels

func ApiChannels() (*[]Channel, error)

Types

type Channel

type Channel struct {
	ChannelId   string `json:"channel_id"`
	ChannelName string `json:"channel_name"`
	VideosCount int    `json:"video_count"`
}

type HitsTotal

type HitsTotal struct {
	Value    int    `json:"value"`
	Relation string `json:"relation"`
}

type ResultHits

type ResultHits struct {
	Total    HitsTotal   `json:"total"`
	MaxScore float64     `json:"max_score"`
	Hits     []VideoData `json:"hits"`
}

type ResultShards

type ResultShards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Skiped     int `json:"skipped"`
	Failed     int `json:"failed"`
}

type SearchQuery

type SearchQuery struct {
	Query     string    `url:"q"`
	VideoId   string    `url:"v"`
	ChannelId string    `url:"channel_id"`
	Sort      SortBy    `url:"sort"`
	SortOrder SortOrder `url:"sort_order"`
	From      *int      `url:"from"`
	Size      *int      `url:"size"`
}

type SearchResult

type SearchResult struct {
	Took     int          `json:"took"`
	TimedOut bool         `json:"timed_out"`
	Shards   ResultShards `json:"_shards"`
	Hits     ResultHits   `json:"hits"`
}

func ApiChannel

func ApiChannel(channel string) (*SearchResult, error)

func ApiSearch

func ApiSearch(q SearchQuery) (*SearchResult, error)

type SortBy

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

func (SortBy) String

func (s SortBy) String() string

type SortOrder

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

func (SortOrder) String

func (s SortOrder) String() string

type VideoData

type VideoData struct {
	Index  string      `json:"_index"`
	Id     string      `json:"_id"`
	Score  float64     `json:"_score"`
	Source VideoSource `json:"_source"`
}

type VideoFiles

type VideoFiles struct {
	Size int    `json:"size"`
	Name string `json:"name"`
}

type VideoSource

type VideoSource struct {
	ChannelName       string          `json:"channel_name"`
	DriveBase         string          `json:"drive_base"`
	LikeCount         int             `json:"like_count"`
	Timestamps        VideoTimestamps `json:"timestamps"`
	Fps               int             `json:"fps"`
	Description       string          `json:"description"`
	Title             string          `json:"title"`
	Duration          int             `json:"duration"`
	ArchivedTimestamp string          `json:"archived_timestamp"`
	Width             int             `json:"width"`
	FormatId          string          `json:"format_id"`
	Files             []VideoFiles    `json:"files"`
	ChannelId         string          `json:"channel_id"`
	ViewCount         int             `json:"view_count"`
	DislikeCount      int             `json:"dislike_count"`
	VideoId           string          `json:"video_id"`
	UploadDate        string          `json:"upload_date"`
	Height            int             `json:"height"`
}

type VideoTimestamps

type VideoTimestamps struct {
	ActualStartTime    string `json:"actualStartTime"`
	PublishedAt        string `json:"publishedAt"`
	ScheduledStartTime string `json:"scheduledStartTime"`
	ActualEndTime      string `json:"actualEndTime"`
}

Jump to

Keyboard shortcuts

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