client

package
v0.0.0-...-ec7097f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_TIMEOUT     = 2
	HTTP_BUFFER_SIZE = 2 * 1024
)

Variables

This section is empty.

Functions

func EncodeSign

func EncodeSign(params map[string]string, secret string) (string, string)

func Md5

func Md5(formal string) string

Types

type ApiError

type ApiError struct {
	Msg string
}

func (*ApiError) Error

func (a *ApiError) Error() string

type BCli

type BCli struct {
	Rank    RankService
	Bangumi BangumiService
	Video   VideoService
	Special SpecialService
	User    UserService
	Others  OthersService
}

func NewClient

func NewClient(appkey, secret string) *BCli

type BangumiService

type BangumiService struct {
	BaseService
}

func (*BangumiService) GetBangumiInfo

func (b *BangumiService) GetBangumiInfo(seasonId string) (*bangumiInfoResponse, error)

func (*BangumiService) GetIndex

func (b *BangumiService) GetIndex() (*bangumiIndexResponse, error)

func (*BangumiService) GetWeekList

func (b *BangumiService) GetWeekList(bType string) (*weekBangumiResponse, error)

type BannerElement

type BannerElement struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	Pic    string `json:"pic"`
	Url    string `json:"url"`
	PosNum int    `json:"pos_num"`
}

type BaseParam

type BaseParam struct {
	Appkey string
	Secret string
}

type BaseService

type BaseService struct {
	Params BaseParam
	Client HttpClient
}

type HttpClient

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

func NewHttpClient

func NewHttpClient() HttpClient

func (*HttpClient) Get

func (b *HttpClient) Get(url string) ([]byte, error)

type OthersService

type OthersService struct {
	BaseService
}

func (*OthersService) AppIndex

func (o *OthersService) AppIndex() (*liveAppIndexResponse, error)

func (*OthersService) IndexBanner

func (o *OthersService) IndexBanner() ([]BannerElement, error)

func (*OthersService) Search

func (o *OthersService) Search(keyword string, page, pageSize int, order string) (*searchResponse, error)

order:

"totalrank"
"click"
"pubdate"
"dm"

searchType:

"all"

func (*OthersService) SearchByType

func (o *OthersService) SearchByType(keyword string, page, pageSize int, searchType int) (*searchByTypeResponse, error)

type RankService

type RankService struct {
	BaseService
}

func (*RankService) SortRank

func (r *RankService) SortRank(tid, page, pageSize int, order string) ([]RankVideoElement, error)

order:

"view",
"senddate",
"reply",
"danmaku",
"favorite",

type RankVideoElement

type RankVideoElement struct {
	Title     string `json:"title"`
	Cover     string `json:"cover"`
	Uri       string `json:"uri"`
	Param     string `json:"param"`
	Goto      string `json:"goto"`
	Name      string `json:"name"`
	Play      int    `json:"play"`
	Reply     int    `json:"reply"`
	Favourite int    `json:"favourite"`
	Danmaku   int    `json:"danmaku"`
}

type SpecialService

type SpecialService struct {
	BaseService
}

func (*SpecialService) GetSpecialInfo

func (s *SpecialService) GetSpecialInfo(spid int) (*specialInfoResponse, error)

func (*SpecialService) GetSpecialVideos

func (s *SpecialService) GetSpecialVideos(spid int, isBangumi bool) (*specialVideosResponse, error)

isBangumi:

the result is "bangumi" or other videos

type UserService

type UserService struct {
	BaseService
}

func (*UserService) GetUserInfo

func (u *UserService) GetUserInfo(mid int) (*userInfoResponse, error)

func (*UserService) GetUserVideos

func (u *UserService) GetUserVideos(mid, page, pageSize int) (*userVideosResponse, error)

type UserVideoElement

type UserVideoElement struct {
	Aid         int    `json:"aid"`
	Copyright   string `json:"copyright"`
	TypeId      int    `json:"typeid"`
	Title       string `json:"title"`
	Subtitle    string `json:"subtitle"`
	Play        int    `json:"play"`
	Review      int    `json:"review"`
	VideoReview int    `json:"video_review"`
	Favorites   int    `json:"favorites"`
	Mid         int    `json:"mid"`
	Author      string `json:"author"`
	Description string `json:"description"`
	Created     string `json:"created"`
	Pic         string `json:"pic"`
	Comment     int    `json:"comment"`
	Length      string `json:"length"`
}

type UserVideoResponse

type UserVideoResponse struct {
}

type VideoService

type VideoService struct {
	BaseService
}

func (*VideoService) GetVideoInfo

func (v *VideoService) GetVideoInfo(aid int) (*videoInfoResponse, error)

func (*VideoService) GetVideoPartPath

func (v *VideoService) GetVideoPartPath(cid int, quality int) (*videoPathResponse, error)

* videoType:

"flv"
"hdmp4"
"mp4"

quality:

1,2,3

Jump to

Keyboard shortcuts

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