util

package
v0.0.0-...-4fff4a8 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AGENT  = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"
	MAIN_HOST   = "http://www.bilibili.com"
	VIDEO_URL   = "http://www.bilibili.com/video/av%d/"
	LOGIN_URL   = "https://passport.bilibili.com/ajax/miniLogin/login"
	COMMENT_URL = "http://api.bilibili.com/x/v2/reply/add"
)

Variables

View Source
var BiliLoginURL *url.URL
View Source
var (
	LOGIN_ERR_MAP = map[int]string{
		-105: "验证码错误",
		-618: "昵称重复或含有非法字符",
		-619: "昵称不能小于3个字符或者大于30个字符",
		-620: "该昵称已被使用",
		-622: "Email已存在",
		-625: "密码错误次数过多",
		-626: "用户不存在",
		-627: "密码错误",
		-628: "密码不能小于6个字符或大于16个字符",
		-645: "昵称或密码过短",
		-646: "请输入正确的手机号",
		-647: "该手机已绑定另外一个账号",
		-648: "验证码发送失败",
		-652: "历史遗留问题,昵称与手机号重复,请联系管理员",
		-662: "加密后的密码已过期",
	}
)

Functions

func BuildVideoReferer

func BuildVideoReferer(id int) string

BuildVideoReferer builds up fake video page referer

func JsonProc

func JsonProc(body *http.Response, container interface{}) error

JsonProc reduces some duplicate code.

func Network

func Network(url, method, query string) (req *http.Request, err error)

Network builds a network request for client.Do.

func StringToCookie

func StringToCookie(cookie string) []*http.Cookie

StringToCookie converts raw string to cookie.

Types

type AddComment

type AddComment struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type UserInfo

type UserInfo struct {
	Code   int  `json:"code"`
	Status bool `json:"status"`
	Data   struct {
		LevelInfo struct {
			CurrentLevel int `json:"current_level"`
			CurrentMin   int `json:"current_min"`
			CurrentExp   int `json:"current_exp"`
			NextExp      int `json:"next_exp"`
		} `json:"level_info"`
		BCoins           int     `json:"bCoins"`
		Coins            float64 `json:"coins"`
		Face             string  `json:"face"`
		NameplateCurrent string  `json:"nameplate_current"`
		Uname            string  `json:"uname"`
		UserStatus       string  `json:"userStatus"`
		VipType          int     `json:"vipType"`
		VipStatus        int     `json:"vipStatus"`
		OfficialVerify   int     `json:"official_verify"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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