biliup

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Overview

Package biliup provides support for uploading videos to bilibili.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBytes

func GetBytes(s int) []byte

func Login

func Login() error

func PutBytes

func PutBytes(slice []byte)

Types

type AddReqJSON

type AddReqJSON struct {
	Copyright        int64    `json:"copyright"` // 1:原创 2:转载
	Cover            string   `json:"cover"`     // 封面url
	Title            string   `json:"title"`     // 视频标题
	Tid              int64    `json:"tid"`       // 分区id
	Tag              string   `json:"tag"`       // 标签 , 分割
	DescFormatID     int64    `json:"desc_format_id"`
	Desc             string   `json:"desc"`             // 简介
	Source           string   `json:"source,omitempty"` // 来源
	Dynamic          string   `json:"dynamic"`
	Interactive      int64    `json:"interactive"`
	Videos           []Video  `json:"videos"`
	ActReserveCreate int64    `json:"act_reserve_create"`
	NoDisturbance    int64    `json:"no_disturbance"`
	NoReprint        int64    `json:"no_reprint"`
	Subtitle         Subtitle `json:"subtitle"`
	Dolby            int64    `json:"dolby"`
	LosslessMusic    int64    `json:"lossless_music"`
	Csrf             string   `json:"csrf"`
}

type Biliup

type Biliup struct {
	Config Config
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *Biliup

func (*Biliup) Upload

func (b *Biliup) Upload() error
Example
package main

import (
	"fmt"

	"github.com/go-olive/olive/foundation/biliup"
)

func main() {
	err := biliup.New(biliup.Config{
		CookieFilepath:    "",
		VideoFilepath:     "",
		Threads:           6,
		MaxBytesPerSecond: 2097152,
	}).Upload()
	if err != nil {
		fmt.Println(err)
	}
}
Output:

type Config

type Config struct {
	CookieFilepath    string
	VideoFilepath     string
	Threads           int64
	MaxBytesPerSecond float64
}

type CookieData

type CookieData struct {
	IsNew        bool   `json:"is_new"`
	Mid          int64  `json:"mid"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	TokenInfo    struct {
		Mid          int64  `json:"mid"`
		AccessToken  string `json:"access_token"`
		RefreshToken string `json:"refresh_token"`
		ExpiresIn    int64  `json:"expires_in"`
	} `json:"token_info"`
	CookieInfo struct {
		Cookies []struct {
			Name     string `json:"name"`
			Value    string `json:"value"`
			HTTPOnly int64  `json:"http_only"`
			Expires  int64  `json:"expires"`
			Secure   int64  `json:"secure"`
		} `json:"cookies"`
		Domains []string `json:"domains"`
	} `json:"cookie_info"`
	Sso []string `json:"sso"`
}

type CookieInfo

type CookieInfo struct {
	Cookie string
	Csrf   string
}

type Part

type Part struct {
	PartNumber int64  `json:"partNumber"`
	ETag       string `json:"eTag"`
}

type PreuploadInfo

type PreuploadInfo struct {
	OK              int64       `json:"OK"`
	Auth            string      `json:"auth"`
	BizID           int64       `json:"biz_id"`
	ChunkRetry      int64       `json:"chunk_retry"`
	ChunkRetryDelay int64       `json:"chunk_retry_delay"`
	ChunkSize       int64       `json:"chunk_size"`
	Endpoint        string      `json:"endpoint"`
	Endpoints       []string    `json:"endpoints"`
	ExposeParams    interface{} `json:"expose_params"`
	PutQuery        string      `json:"put_query"`
	Threads         int64       `json:"threads"`
	Timeout         int64       `json:"timeout"`
	Uip             string      `json:"uip"`
	UposURI         string      `json:"upos_uri"`
}

type ReqJSON

type ReqJSON struct {
	Parts []Part `json:"parts"`
}

type Subtitle

type Subtitle struct {
	Open int64  `json:"open"`
	Lan  string `json:"lan"`
}

type UploadInfo

type UploadInfo struct {
	Location string `json:"location"`
	Etag     string `json:"etag"`
	OK       int64  `json:"OK"`
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	UploadID string `json:"upload_id"`
}

type UploadMetadata

type UploadMetadata struct {
	Auth      string
	BaseURL   string
	FileName  string
	ChunkSize int64
	BizID     int64

	UploadID string
}

type Video

type Video struct {
	Filename string `json:"filename"`
	Title    string `json:"title"`
	Desc     string `json:"desc"`
	Cid      int64  `json:"cid"`
}

type VideoMetadata

type VideoMetadata struct {
	Filepath string // 视频路径
	Filename string // 视频名称
	Filesize int64  // 视频大小
	Title    string // 视频标题
	Desc     string // 视频简介
	UpType   int64  // 1:原创 2:转载
	Cover    string // 封面路径
	Tid      int64  // 分区id
	Tag      string // 标签 `,`分割
	Source   string // 来源
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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