bilibili_go

package module
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

README

bilibili-go

简介 📜

GitHub go.mod Go version (subdirectory of monorepo) GitHub GitHub tag (with filter)

使用bilibili-go来顺畅的接入bilibili,支持视频投稿,个人信息查询...

Warning ⚠️

!!!目前项目处于开发阶段,并非稳定版本,接口可能会变更,其他接口陆续接入中🔨...

使用 🥑

  1. 下载包

    go get github.com/kainhuck/bilibili-go
    
  2. 导入包

    import bilibili_go "github.com/kainhuck/bilibili-go"
    
  3. 使用包

    参考 👉demo

  4. options介绍

    1. 自定义http客户端 用户可以通过自定义http客户端来使用代理或者其他需求,比如

      proxyURL, err := url.Parse("http://proxy.example.com:8080")
      if err != nil {
          panic(err)
      }
      
      client := bilibili_go.NewClient(
          bilibili_go.WithHttpClient(&http.Client{
              Transport: &http.Transport{
                  Proxy: http.ProxyURL(proxyURL),
              },
          }),
      )
      
    2. 缓存cookie

      用户可以实现下面这个接口来定义自己的存储,如果设置了缓存,在第二次登陆时将不再需要授权,除非缓存过期,在加载缓存时会自动校验授权信息是否过期

      type AuthStorage interface {
          // LoadAuthInfo 加载AuthInfo
          LoadAuthInfo() (*AuthInfo, error)
      
          // SaveAuthInfo 保存AuthInfo
          SaveAuthInfo(*AuthInfo) error
      
          // LogoutAuthInfo 账号退出登陆时会调用该方法
          LogoutAuthInfo(*AuthInfo) error
      }
      

      默认提供了一个文件缓存的实现fileAuthStorage可以如下使用

      cient := bilibili_go.NewClient(
           bilibili_go.WithAuthStorage(bilibili_go.NewFileAuthStorage("文件路径")),
      )
      
    3. 开启调试

      开启debug模式后,将会向指定的文件中写入http的报文

      client := bilibili_go.NewClient(
           bilibili_go.WithDebug(true), // 将会向 stdout 输出http报文
      )
      
      f, err := os.Open("debug.txt")
      if err != nil {
          panic(err)
      }
      defer f.Close()
      
      client := bilibili_go.NewClient(
          bilibili_go.WithDebug(true, f), // 将会向 debug.txt 输出http报文
      )
      
    4. 自定义处理登陆二维码

      在使用LoginWithQrCode方法登陆时,默认会将登陆二维码输出到标准输出,用户可以配置自己的输出方法来自定义处理登陆二维码,比如将其发送到指定的群组或个人

      client := bilibili_go.NewClient(
          bilibili_go.WithShowQRCodeFunc(func(code *qrcode.QRCode) error {
        	  // ....
        	  return nil
          }),
      )
      
    5. 自定义User-Agent

      默认UA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"

      client := bilibili_go.NewClient(
        bilibili_go.WithUserAgent("abc"),
      )
      
    6. 使用自定义logger

      用户可以设置任何实现了Logger接口的日志,默认使用logrus.StandardLogger()

      type Logger interface {
          Debug(args ...any)
          Info(args ...any)
          Warn(args ...any)
          Error(args ...any)
          Debugf(format string, args ...any)
          Infof(format string, args ...any)
          Warnf(format string, args ...any)
          Errorf(format string, args ...any)
      }
      
      client := bilibili_go.NewClient(
          bilibili_go.WithLogger(log),
      )
      
    7. 设置cookie刷新时间

    默认1分种检查一次cookie是否需要刷新,如果设置为0则不检查刷新

    client := bilibili_go.NewClient(
        bilibili_go.WithRefreshInterval(time.Hour),
    )
    

特别鸣谢 🥰

bilibili-API-collect

更新日志 🐥

v0.3.6

  1. 新增token定期检查token刷新功能

v0.3.5

  1. 新增token刷新功能
  2. 查询每日奖励状态
  3. 视频投币,分享,点赞
  4. 一键三连
  5. 获取热门视频排行
  6. 视频排行榜
  7. 最新视频
  8. 入站必刷视频

v0.3.4

  1. 新增登出功能

v0.3.3

  1. 封装了关系操作接口
  2. 新增查询用户与自己的关系接口
  3. 新增查询用户与自己的互相关系接口
  4. 新增批量查询用户与自己的关系
  5. 新增查询关注分组列表
  6. 新增其他分组操作

v0.3.2

  1. 新增操作用户关系接口
  2. 新增批量操作用户关系接口

v0.3.1

  1. 新增查询用户粉丝列表接口
  2. 新增查询用户关注列表接口
  3. 新增搜索用户关注列表接口
  4. 新增查询共同关注列表接口
  5. 新增查询悄悄关注列表接口
  6. 新增查询互相关注列表接口
  7. 新增查询黑名单列表接口

v0.3.0

  1. 新增关系状态数接口
  2. 新增up状态数接口
  3. 新增相簿投稿数接口
  4. 优化封面上传方式,支持从io读取,http读取
  5. auth info 缓存用户信息

v0.2.6

  1. 更新auth info的存储模块
  2. 可自定义auth info存储

v0.2.5

  1. 更新分区

v0.2.4

  1. 可自定义处理登陆二维码

v0.2.3

  1. 添加视频分区

v0.2.2

  1. 更新debug调试,可输出到指定文件
  2. 新增日志配置,可使用自定义日志
  3. 更新多渠道视频上传,本地磁盘,io,http

v0.2.1

  1. 更新认证信息缓存
  2. 新增refresh_token

v0.2.0

  1. 修改登陆接口
  2. 增加debug参数
  3. 新增 获取硬币数 接口
  4. 新增 用户空间详细信息 接口
  5. 新增 用户名片信息 接口
  6. 新增 登陆用户空间详细信息 接口

v0.1.0

  1. 支持扫码登陆
  2. 支持缓存cookie
  3. 支持视频上传
  4. 支持封面上传
  5. 支持投稿视频
  6. 支持查询个人信息相关接口

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnimalGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"动物圈(主分区)", "animal", 217, "", "/v/animal"},
	subZones: map[int]*VideoZone{
		218: {"喵星人", "cat", 218, "喵喵喵喵喵", "/v/animal/cat"},
		219: {"汪星人", "dog", 219, "汪汪汪汪汪", "/v/animal/dog"},
		220: {"大熊猫", "panda", 220, "芝麻汤圆营业中", "/v/animal/panda"},
		221: {"野生动物", "wild_animal", 221, "内有“猛兽”出没", "/v/animal/wild_animal"},
		222: {"爬宠", "reptiles", 222, "鳞甲有灵", "/v/animal/reptiles"},
		75:  {"动物综合", "animal_composite", 75, "收录除上述子分区外,其余动物相关视频以及非动物主体或多个动物主体的动物相关延伸内容", "/v/animal/animal_composite"},
	},
}

AnimalGroup 动物圈分区

View Source
var AnimeGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"番剧(主分区)", "anime", 13, "", "/anime"},
	subZones: map[int]*VideoZone{
		51:  {"资讯", "information", 51, "以动画/轻小说/漫画/杂志为主的资讯内容,PV/CM/特报/冒头/映像/预告", "/v/anime/information"},
		152: {"官方延伸", "official", 152, "以动画番剧及声优为主的EVENT/生放送/DRAMA/RADIO/LIVE/特典/冒头等", "/v/anime/official"},
		32:  {"完结动画", "finish", 32, "已完结TV/WEB动画及其独立系列,旧剧场版/OVA/SP/未放送", "/v/anime/finish"},
		33:  {"连载动画", "serial", 33, "连载中TV/WEB动画,新剧场版/OVA/SP/未放送/小剧场", "/v/anime/serial"},
	},
}

AnimeGroup 番剧分区

View Source
var CarGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"汽车(主分区)", "car", 223, "", "/v/car"},
	subZones: map[int]*VideoZone{
		245: {"赛车", "racing", 245, "f1等汽车运动相关", "/v/car/racing"},
		246: {"改装玩车", "modifiedvehicle", 246, "汽车文化及改装车相关内容,包括改装车、老车修复介绍、汽车聚会分享等内容", "/v/car/modifiedvehicle"},
		247: {"新能源车", "newenergyvehicle", 247, "新能源汽车相关内容,包括电动汽车、混合动力汽车等车型种类,包含不限于新车资讯、试驾体验、专业评测、技术解读、知识科普等内容", "/v/car/newenergyvehicle"},
		248: {"房车", "touringcar", 248, "房车及营地相关内容,包括不限于产品介绍、驾驶体验、房车生活和房车旅行等内容", "/v/car/touringcar"},
		240: {"摩托车", "motorcycle", 240, "骑士们集合啦", "/v/car/motorcycle"},
		227: {"购车攻略", "strategy", 227, "丰富详实的购车建议和新车体验", "/v/car/strategy"},
		176: {"汽车生活", "life", 176, "分享汽车及出行相关的生活体验类视频", "/v/car/life"},
	},
}

CarGroup 汽车分区

View Source
var CinephileGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"影视(主分区)", "cinephile", 181, "", "/v/cinephile"},
	subZones: map[int]*VideoZone{
		182: {"影视杂谈", "cinecism", 182, "影视评论、解说、吐槽、科普等", "/v/cinephile/cinecism"},
		183: {"影视剪辑", "montage", 183, "对影视素材进行剪辑再创作的视频", "/v/cinephile/montage"},
		85:  {"小剧场", "shortfilm", 85, "有场景、有剧情的演绎类内容", "/v/cinephile/shortfilm"},
		184: {"预告·资讯", "trailer_info", 184, "影视类相关资讯,预告,花絮等视频", "/v/cinephile/trailer_info"},
	},
}

CinephileGroup 影视分区

View Source
var DanceGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"舞蹈(主分区)", "dance", 129, "", "/v/dance"},
	subZones: map[int]*VideoZone{
		20:  {"宅舞", "otaku", 20, "与acg相关的翻跳、原创舞蹈", "/v/dance/otaku"},
		154: {"舞蹈综合", "three_d", 154, "收录无法定义到其他舞蹈子分区的舞蹈视频", "/v/dance/three_d"},
		156: {"舞蹈教程", "demo", 156, "镜面慢速,动作分解,基础教程等具有教学意义的舞蹈视频", "/v/dance/demo"},
		198: {"街舞", "hiphop", 198, "收录街舞相关内容,包括赛事现场、舞室作品、个人翻跳、freestyle等", "/v/dance/hiphop"},
		199: {"明星舞蹈", "star", 199, "国内外明星发布的官方舞蹈及其翻跳内容", "/v/dance/star"},
		200: {"中国舞", "china", 200, "传承中国艺术文化的舞蹈内容,包括古典舞、民族民间舞、汉唐舞、古风舞等", "/v/dance/china"},
	},
}

DanceGroup 舞蹈分区

View Source
var DocumentaryGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"纪录片(主分区)", "documentary", 177, "", "/documentary"},
	subZones: map[int]*VideoZone{
		37:  {"人文·历史", "history", 37, "除宣传片、影视剪辑外的,人文艺术历史纪录剧集或电影、预告、花絮、二创、5分钟以上纪录短片", "/v/documentary/history"},
		178: {"科学·探索·自然", "science", 178, "除演讲、网课、教程外的,科学探索自然纪录剧集或电影、预告、花絮、二创、5分钟以上纪录短片", "/v/documentary/science"},
		179: {"军事", "military", 179, "除时政军事新闻外的,军事纪录剧集或电影、预告、花絮、二创、5分钟以上纪录短片", "/v/documentary/military"},
		180: {"社会·美食·旅行", "travel", 180, "除VLOG、风光摄影外的,社会美食旅行纪录剧集或电影、预告、花絮、二创、5分钟以上纪录短片", "/v/documentary/travel"},
	},
}

DocumentaryGroup 纪录片分区

View Source
var DougaGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"动画(主分区)", "dougua", 1, "", "/v/douga"},
	subZones: map[int]*VideoZone{
		24:  {"MAD.AMV", "mad", 24, "具有一定创作度的动/静画二次创作视频", "/v/douga/mad"},
		25:  {"MMD·3D", "mmd", 24, "使用mmd(mikumikudance)和其他3d建模类软件制作的视频", "/v/douga/mmd"},
		47:  {"短片·手书·配音", "voice", 47, "追求个人特色和创意表达的自制动画短片、手书(绘)及acgn相关配音", "/v/douga/voice"},
		210: {"手办·模玩", "garage_kit", 210, "手办模玩的测评、改造或其他衍生内容", "/v/douga/garage_kit"},
		86:  {"特摄", "tokusatsu", 86, "特摄相关衍生视频", "/v/douga/tokusatsu"},
		253: {"动漫杂谈", "acgntalks", 253, "以谈话形式对ACGN文化圈进行的鉴赏、吐槽、评点、解说、推荐、科普等内容", "/v/douga/acgntalks"},
		27:  {"综合", "other", 27, "以动画及动画相关内容为素材,包括但不仅限于音频替换、恶搞改编、排行榜等内容", "/v/douga/other"},
	},
}

DougaGroup 动画分区

View Source
var EntGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"娱乐(主分区)", "ent", 5, "", "/v/ent"},
	subZones: map[int]*VideoZone{
		71:  {"综艺", "variety", 71, "所有综艺相关,全部一手掌握!", "/v/ent/variety"},
		241: {"娱乐杂谈", "talker", 241, "娱乐人物解读、娱乐热点点评、娱乐行业分析", "/v/ent/talker"},
		242: {"粉丝创作", "fans", 242, "粉丝向创作视频", "/v/ent/fans"},
		137: {"明星综合", "celebrity", 137, "娱乐圈动态、明星资讯相关", "/v/ent/celebrity"},
	},
}

EntGroup 娱乐分区

View Source
var FashionGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"时尚(主分区)", "fashion", 155, "", "/v/fashion"},
	subZones: map[int]*VideoZone{
		157: {"美妆护肤", "makeup", 157, "彩妆护肤、美甲美发、仿妆、医美相关内容分享或产品测评", "/v/fashion/makeup"},
		252: {"仿妆cos", "cos", 252, "对二次元、三次元人物角色进行模仿、还原、展示、演绎的内容", "/v/fashion/cos"},
		158: {"穿搭", "clothing", 158, "穿搭风格、穿搭技巧的展示分享,涵盖衣服、鞋靴、箱包配件、配饰(帽子、钟表、珠宝首饰)等", "/v/fashion/clothing"},
		159: {"时尚潮流", "catwalk", 159, "时尚街拍、时装周、时尚大片,时尚品牌、潮流等行业相关记录及知识科普", "/v/fashion/catwalk"},
	},
}

FashionGroup 时尚分区

View Source
var FoodGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"美食(主分区)", "food", 211, "", "/v/food"},
	subZones: map[int]*VideoZone{
		76:  {"美食制作", "make", 76, "学做人间美味,展示精湛厨艺", "/v/food/make"},
		212: {"美食侦探", "detective", 212, "寻找美味餐厅,发现街头美食", "/v/food/detective"},
		213: {"美食测评", "measurement", 213, "吃货世界,品尝世间美味", "/v/food/measurement"},
		214: {"田园美食", "rural", 214, "品味乡野美食,寻找山与海的味道", "/v/food/rural"},
		215: {"美食记录", "record", 215, "记录一日三餐,给生活添一点幸福感", "/v/food/record"},
	},
}

FoodGroup 美食分区

View Source
var GameGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"游戏(主分区)", "game", 4, "", "/v/game"},
	subZones: map[int]*VideoZone{
		17:  {"单机游戏", "stand_alone", 17, "以所有平台(pc、主机、移动端)的单机或联机游戏为主的视频内容,包括游戏预告、cg、实况解说及相关的评测、杂谈与视频剪辑等", "/v/game/stand_alone"},
		171: {"电子竞技", "esports", 171, "具有高对抗性的电子竞技游戏项目,其相关的赛事、实况、攻略、解说、短剧等视频", "/v/game/esports"},
		172: {"手机游戏", "mobile", 172, "以手机及平板设备为主要平台的游戏,其相关的实况、攻略、解说、短剧、演示等视频", "/v/game/mobile"},
		65:  {"网络游戏", "online", 65, "由网络运营商运营的多人在线游戏,以及电子竞技的相关游戏内容。包括赛事、攻略、实况、解说等相关视频", "/v/game/online"},
		173: {"桌游棋牌", "board", 173, "桌游、棋牌、卡牌对战等及其相关电子版游戏的实况、攻略、解说、演示等视频", "/v/game/board"},
		121: {"GMV", "gmv", 121, "由游戏素材制作的mv视频。以游戏内容或cg为主制作的,具有一定创作程度的mv类型的视频", "/v/game/gmv"},
		136: {"音游", "music", 136, "各个平台上,通过配合音乐与节奏而进行的音乐类游戏视频", "/v/game/music"},
		19:  {"Mugen", "mugen", 19, "以Mugen引擎为平台制作、或与Mugen相关的游戏视频", "/v/game/mugen"},
	},
}

GameGroup 游戏分区

View Source
var GuochuangGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"国创(主分区)", "guochuang", 167, "", "/guochuang"},
	subZones: map[int]*VideoZone{
		153: {"国产动画", "chinese", 153, "国产连载动画,国产完结动画", "/v/guochuang/chinese"},
		168: {"国产原创相关", "original", 168, "以国产动画、漫画、小说为素材的二次创作", "/v/guochuang/original"},
		169: {"布袋戏", "puppetry", 169, "布袋戏以及相关剪辑节目", "/v/guochuang/puppetry"},
		170: {"资讯", "information", 170, "原创国产动画、漫画的相关资讯、宣传节目等", "/v/guochuang/information"},
		195: {"动态漫·广播剧", "motioncomic", 195, "国产动态漫画、有声漫画、广播剧", "/v/guochuang/motioncomic"},
	},
}

GuochuangGroup 国创分区

View Source
var InformationGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"资讯(主分区)", "information", 202, "", "/v/information"},
	subZones: map[int]*VideoZone{
		203: {"热点", "hotspot", 203, "全民关注的时政热门资讯", "/v/information/hotspot"},
		204: {"环球", "global", 204, "全球范围内发生的具有重大影响力的事件动态", "/v/information/global"},
		205: {"社会", "social", 205, "日常生活的社会事件、社会问题、社会风貌的报道", "/v/information/social"},
		206: {"综合", "multiple", 206, "除上述领域外其它垂直领域的综合资讯", "/v/information/multiple"},
	},
}

InformationGroup 咨询分区

View Source
var KichikuGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"鬼畜(主分区)", "kichiku", 119, "", "/v/kichiku"},
	subZones: map[int]*VideoZone{
		22:  {"鬼畜调教", "guide", 22, "使用素材在音频、画面上做一定处理,达到与bgm一定的同步感", "/v/kichiku/guide"},
		26:  {"音MAD", "mad", 26, "使用素材音频进行一定的二次创作来达到还原原曲的非商业性质稿件", "/v/kichiku/mad"},
		126: {"人力VOCALOID", "manual_vocaloid", 126, "将人物或者角色的无伴奏素材进行人工调音,使其就像VOCALOID一样歌唱的技术", "/v/kichiku/manual_vocaloid"},
		216: {"鬼畜剧场", "theatre", 216, "使用素材进行人工剪辑编排的有剧情的作品", "/v/kichiku/theatre"},
		127: {"教程演示", "course", 127, "鬼畜相关的科普和教程演示", "/v/kichiku/course"},
	},
}

KichikuGroup 鬼畜分区

View Source
var KnowledgeGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"知识(主分区)", "knowledge", 36, "", "/v/knowledge"},
	subZones: map[int]*VideoZone{
		201: {"科学科普", "science", 201, "回答你的十万个为什么", "/v/knowledge/science"},
		124: {"社科·法律·心理", "social_science", 124, "基于社会科学、法学、心理学展开或个人观点输出的知识视频", "/v/knowledge/social_science"},
		228: {"人文历史", "humanity_history", 228, "看看古今人物,聊聊历史过往,品品文学典籍", "/v/knowledge/humanity_history"},
		207: {"财经商业", "business", 207, "说金融市场,谈宏观经济,一起畅聊商业故事", "/v/knowledge/finance"},
		208: {"校园学习", "campus", 208, "老师很有趣,学生也有才,我们一起搞学习", "/v/knowledge/campus"},
		209: {"职业职场", "career", 209, "职业分享、升级指南,一起成为最有料的职场人", "/v/knowledge/career"},
		229: {"设计·创意", "design", 229, "天马行空,创意设计,都在这里", "/v/knowledge/design"},
		122: {"野生技术协会", "skill", 122, "技能党集合,是时候展示真正的技术了", "/v/knowledge/skill"},
	},
}

KnowledgeGroup 知识分区

View Source
var LifeGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"生活(主分区)", "life", 160, "", "/v/life"},
	subZones: map[int]*VideoZone{
		138: {"搞笑", "funny", 138, "各种沙雕有趣的搞笑剪辑,挑战,表演,配音等视频", "/v/life/funny"},
		250: {"出行", "travel", 250, "为达到观光游览、休闲娱乐为目的的远途旅行、中近途户外生活、本地探店", "/v/life/travel"},
		251: {"三农", "rurallife", 251, "分享美好农村生活", "/v/life/rurallife"},
		239: {"家居房产", "home", 239, "与买房、装修、居家生活相关的分享", "/v/life/home"},
		161: {"手工", "handmake", 161, "手工制品的制作过程或成品展示、教程、测评类视频", "/v/life/handmake"},
		162: {"绘画", "painting", 162, "绘画过程或绘画教程,以及绘画相关的所有视频", "/v/life/painting"},
		21:  {"日常", "daily", 21, "记录日常生活,分享生活故事", "/v/life/daily"},
	},
}

LifeGroup 生活分区

View Source
var MovieGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"电影(主分区)", "movie", 23, "", "/movie"},
	subZones: map[int]*VideoZone{
		147: {"华语电影", "chinese", 147, "", "/v/movie/chinese"},
		145: {"欧美电影", "west", 145, "", "/v/movie/west"},
		146: {"日本电影", "japan", 146, "", "/v/movie/japan"},
		83:  {"其他国家", "movie", 83, "", "/v/movie/movie"},
	},
}

MovieGroup 电影分区

View Source
var MusicGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"音乐(主分区)", "music", 3, "", "/v/music"},
	subZones: map[int]*VideoZone{
		28:  {"原创音乐", "original", 28, "原创歌曲及纯音乐,包括改编、重编曲及remix", "/v/music/original"},
		31:  {"翻唱", "cover", 31, "对曲目的人声再演绎视频", "/v/music/cover"},
		30:  {"VOCALOID·UTAU", "vocaloid", 30, "以vocaloid等歌声合成引擎为基础,运用各类音源进行的创作", "/v/music/vocaloid"},
		59:  {"演奏", "perform", 59, "乐器和非传统乐器器材的演奏作品", "/v/music/perform"},
		193: {"MV", "mv", 193, "为音乐作品配合拍摄或制作的音乐录影带(music video),以及自制拍摄、剪辑、翻拍mv", "/v/music/mv"},
		29:  {"音乐现场", "live", 29, "音乐表演的实况视频,包括官方/个人拍摄的综艺节目、音乐剧、音乐节、演唱会等", "/v/music/live"},
		130: {"音乐综合", "other", 130, "所有无法被收纳到其他音乐二级分区的音乐类视频", "/v/music/other"},
		243: {"乐评盘点", "commentary", 243, "音乐类新闻、盘点、点评、reaction、榜单、采访、幕后故事、唱片开箱等", "/v/music/commentary"},
		244: {"音乐教学", "tutorial", 244, "以音乐教学为目的的内容", "/v/music/tutorial"},
	},
}

MusicGroup 音乐分区

View Source
var SportsGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"运动(主分区)", "sports", 234, "", "/v/sports"},
	subZones: map[int]*VideoZone{
		235: {"篮球", "basketball", 235, "与篮球相关的视频,包括但不限于篮球赛事、教学、评述、剪辑、剧情等相关内容", "/v/sports/basketball"},
		249: {"足球", "football", 249, "与足球相关的视频,包括但不限于足球赛事、教学、评述、剪辑、剧情等相关内容", "/v/sports/football"},
		164: {"健身", "aerobics", 164, "与健身相关的视频,包括但不限于瑜伽、crossfit、健美、力量举、普拉提、街健等相关内容", "/v/sports/aerobics"},
		236: {"竞技体育", "athletic", 236, "与竞技体育相关的视频,包括但不限于乒乓、羽毛球、排球、赛车等竞技项目的赛事、评述、剪辑、剧情等相关内容", "/v/sports/culture"},
		237: {"运动文化", "culture", 237, "与运动文化相关的视频,包络但不限于球鞋、球衣、球星卡等运动衍生品的分享、解读,体育产业的分析、科普等相关内容", "/v/sports/culture"},
		238: {"运动综合", "comprehensive", 238, "与运动综合相关的视频,包括但不限于钓鱼、骑行、滑板等日常运动分享、教学、Vlog等相关内容", "/v/sports/comprehensive"},
	},
}

SportsGroup 运动分区

View Source
var TechGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"科技(主分区)", "tech", 188, "", "/v/tech"},
	subZones: map[int]*VideoZone{
		95:  {"数码", "digital", 95, "科技数码产品大全,一起来做发烧友", "/v/tech/digital"},
		230: {"软件应用", "application", 230, "超全软件应用指南", "/v/tech/application"},
		231: {"计算机技术", "computer_tech", 231, "研究分析、教学演示、经验分享......有关计算机技术的都在这里", "/v/tech/computer_tech"},
		232: {"科工机械", "industry", 232, "前方高能,机甲重工即将出没", "/v/tech/industry"},
		233: {"极客DIY", "diy", 233, "炫酷技能,极客文化,硬核技巧,准备好你的惊讶", "/v/tech/diy"},
	},
}

TechGroup 科技分区

View Source
var TvGroup = &VideoZoneGroup{
	mainZone: &VideoZone{"电视剧(主分区)", "tv", 11, "", "/tv"},
	subZones: map[int]*VideoZone{
		185: {"国产剧", "mainland", 185, "", "/v/tv/mainland"},
		187: {"海外剧", "overseas", 187, "", "/v/tv/overseas"},
	},
}

TvGroup 电视剧分区

Functions

This section is empty.

Types

type AccRelation added in v0.3.3

type AccRelation struct {
	Relation   Relation `json:"relation"`
	BeRelation Relation `json:"be_relation"`
}

AccRelation 相互关系

type AccountResponse

type AccountResponse struct {
	Mid      int64  `json:"mid"`
	Uname    string `json:"uname"`
	UserID   string `json:"userid"`
	Sign     string `json:"sign"`
	BirthDay string `json:"birthday"`
	Sex      string `json:"sex"`
	NickFree bool   `json:"nick_free"`
	Rank     string `json:"rank"`
}

AccountResponse for account response

type Attribute added in v0.3.3

type Attribute int
const (
	// UnFollowed 未关注
	UnFollowed Attribute = 0
	// Followed 已关注
	Followed Attribute = 2
	// FollowEachOther 已互粉
	FollowEachOther Attribute = 6
	// InBlacklist 已拉黑
	InBlacklist Attribute = 128
)

type AuthInfo added in v0.2.6

type AuthInfo struct {
	Cookies      []*http.Cookie `json:"cookies"`
	RefreshToken string         `json:"refresh_token"`
}

type AuthStorage added in v0.2.6

type AuthStorage interface {
	// LoadAuthInfo 加载AuthInfo
	LoadAuthInfo() (*AuthInfo, error)

	// SaveAuthInfo 保存AuthInfo
	SaveAuthInfo(*AuthInfo) error

	// LogoutAuthInfo 账号退出登陆时会调用该方法
	LogoutAuthInfo(*AuthInfo) error
}

func NewFileAuthStorage added in v0.2.6

func NewFileAuthStorage(file string) AuthStorage

type BaseResponse

type BaseResponse struct {
	Code    Code        `json:"code"`
	Message string      `json:"message"`
	TTL     int         `json:"ttl"`
	Data    interface{} `json:"data"`
}

BaseResponse dor base response

func NewBaseResponse

func NewBaseResponse(body io.Reader) (*BaseResponse, error)

func (*BaseResponse) RawData

func (r *BaseResponse) RawData() []byte

type BatchModifyRelationResponse added in v0.3.2

type BatchModifyRelationResponse struct {
	FailedFids []string `json:"failed_fids"` // 操作失败的 mid 列表
}

BatchModifyRelationResponse 批量操作关系

type Client

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

func NewClient

func NewClient(opts ...Option) *Client

func (*Client) AddUsersToRelationTags added in v0.3.3

func (c *Client) AddUsersToRelationTags(mids []string, tagIds []int) error

AddUsersToRelationTags 往分组内添加成员 https://api.bilibili.com/x/relation/tags/addUsers 通过该接口可以将多个用户移动到多个分组 如需移除分组中的成员,请将tagids设为 0,即移动至默认分组,而不是取关 mids 用户ID tagIds 分组ID

func (*Client) BatchGetRelation added in v0.3.3

func (c *Client) BatchGetRelation(mid ...string) (map[string]Relation, error)

BatchGetRelation 批量查询用户与自己的关系 https://api.bilibili.com/x/relation/relations 返回的key是mid

func (*Client) BatchModifyRelation added in v0.3.2

func (c *Client) BatchModifyRelation(mids []string, act int, reSrc int) (*BatchModifyRelationResponse, error)

BatchModifyRelation 批量操作用户关系 https://api.bilibili.com/x/relation/batch/modify mids 目标用户mid act 操作代码

1 关注
5 拉黑

reSrc 关注来源

11 空间
14 视频
115 文章
222 活动页面

func (*Client) Block added in v0.3.3

func (c *Client) Block(mid interface{}) error

Block 拉黑用户

func (*Client) CoinVideo added in v0.3.5

func (c *Client) CoinVideo(id string, coins int) error

CoinVideo 视频投币 id 视频ID av号或者bv号 coins 硬币数量

func (*Client) CopyUsersToRelationTags added in v0.3.3

func (c *Client) CopyUsersToRelationTags(mids []string, tagIds []int) error

CopyUsersToRelationTags 复制成员到分组 https://api.bilibili.com/x/relation/tags/copyUsers mids 用户ID tagIds 分组ID

func (*Client) CreateRelationTag added in v0.3.3

func (c *Client) CreateRelationTag(name string) (*CreateRelationTagResponse, error)

CreateRelationTag 创建分组 https://api.bilibili.com/x/relation/tag/create name 分组名称

func (*Client) DeleteRelationTag added in v0.3.3

func (c *Client) DeleteRelationTag(tagId int) error

DeleteRelationTag 删除分组 https://api.bilibili.com/x/relation/tag/del

func (*Client) Follow added in v0.3.3

func (c *Client) Follow(mid interface{}) error

Follow 关注用户

func (*Client) GetAccRelation added in v0.3.3

func (c *Client) GetAccRelation(mid interface{}) (*AccRelation, error)

GetAccRelation 查询用户与自己的互相关系 https://api.bilibili.com/x/space/wbi/acc/relation

func (*Client) GetBlacks added in v0.3.1

func (c *Client) GetBlacks(ps int, pn int) (*RelationUserResponse, error)

GetBlacks 查询黑名单列表 https://api.bilibili.com/x/relation/blacks ps 每页大小 pn 页码

func (*Client) GetCoin added in v0.2.0

func (c *Client) GetCoin() (*GetCoinResponse, error)

GetCoin 获取硬币数 https://account.bilibili.com/site/getCoin

func (*Client) GetDocUploadCount added in v0.3.0

func (c *Client) GetDocUploadCount(mid interface{}) (*GetDocUploadCountResponse, error)

GetDocUploadCount 相簿投稿数 https://api.vc.bilibili.com/link_draw/v1/doc/upload_count

func (*Client) GetExpReword added in v0.3.5

func (c *Client) GetExpReword() (*ExpReward, error)

GetExpReword 查询每日奖励状态 https://api.bilibili.com/x/member/web/exp/reward

func (*Client) GetFollowers added in v0.3.3

func (c *Client) GetFollowers(ps int, pn int) (*RelationUserResponse, error)

GetFollowers 查询自己的粉丝

func (*Client) GetFollowings added in v0.3.3

func (c *Client) GetFollowings(orderType string, ps int, pn int) (*RelationUserResponse, error)

GetFollowings 查询自己的关注

func (*Client) GetFollowingsV2 added in v0.3.3

func (c *Client) GetFollowingsV2(ps int, pn int) (*RelationUserResponse, error)

GetFollowingsV2 查询自己的关注

func (*Client) GetFriends added in v0.3.1

func (c *Client) GetFriends() (*RelationUserResponse, error)

GetFriends 查询互相关注列表 https://api.bilibili.com/x/relation/friends mid 目标用户ID ps 每页大小 pn 页码 只能查看自己的互相关注,total字段不返回,list 返回全部

func (*Client) GetLatestVideo added in v0.3.5

func (c *Client) GetLatestVideo(pn int, ps int, tid int) (*GetLatestVideoResponse, error)

GetLatestVideo 最新视频列表 pn 页码 ps 每页项数 tid 分区ID 不能为0

func (*Client) GetMyAccount added in v0.3.5

func (c *Client) GetMyAccount() (*AccountResponse, error)

GetMyAccount 获取个人账号信息 https://api.bilibili.com/x/member/web/account

func (*Client) GetMyInfo added in v0.2.0

func (c *Client) GetMyInfo() (*GetMyInfoResponse, error)

GetMyInfo 登陆用户空间详细信息 https://api.bilibili.com/x/space/myinfo

func (*Client) GetNavigation

func (c *Client) GetNavigation() (*NavigationResponse, error)

GetNavigation 获取导航栏信息(个人详细信息) https://api.bilibili.com/x/web-interface/nav

func (*Client) GetNavigationStatus

func (c *Client) GetNavigationStatus() (*NavigationStatusResponse, error)

GetNavigationStatus 获取导航栏状态(粉丝数信息)https://api.bilibili.com/x/web-interface/nav/stat

func (*Client) GetPopularVideoList added in v0.3.5

func (c *Client) GetPopularVideoList(pn int, ps int, common bool) (*GetPopularVideoListResponse, error)

GetPopularVideoList 获取热门视频列表 pn 页码 ps 每页项数 common true 展示非个性化的列表 false 展示个性化列表

func (*Client) GetPreciousVideo added in v0.3.5

func (c *Client) GetPreciousVideo() ([]*Video, error)

GetPreciousVideo 入站必刷视频

func (*Client) GetRelation added in v0.3.3

func (c *Client) GetRelation(mid interface{}) (*Relation, error)

GetRelation 查询用户与自己的关系 https://api.bilibili.com/x/relation mid 用户ID

func (*Client) GetRelationStat added in v0.3.0

func (c *Client) GetRelationStat(mid interface{}) (*GetRelationStatResponse, error)

GetRelationStat 获取用户关系状态 https://api.bilibili.com/x/relation/stat

func (*Client) GetRelationTagUsers added in v0.3.3

func (c *Client) GetRelationTagUsers(tagId int, orderType string, ps int, pn int) ([]*RelationUser, error)

GetRelationTagUsers 查询关注分组内的用户 https://api.bilibili.com/x/relation/tag tagId 关注分组id 可通过 GetRelationTags 接口获取 orderType 按照关注顺序排列:留空 按照最常访问排列:attention ps 每页项数 pn 页码

func (*Client) GetRelationTags added in v0.3.3

func (c *Client) GetRelationTags() ([]*RelationTag, error)

GetRelationTags 查询关注分组列表 https://api.bilibili.com/x/relation/tags

func (*Client) GetSameFollowings added in v0.3.1

func (c *Client) GetSameFollowings(mid interface{}, ps int, pn int) (*RelationUserResponse, error)

GetSameFollowings 查询共同关注列表 https://api.bilibili.com/x/relation/same/followings mid 目标用户ID ps 每页大小 pn 页码

func (*Client) GetSpecialRelationTagUsers added in v0.3.3

func (c *Client) GetSpecialRelationTagUsers() ([]string, error)

GetSpecialRelationTagUsers 查询特别关注的所有用户mid https://api.bilibili.com/x/relation/tag/special 返回所有用户的mid

func (*Client) GetUpStat added in v0.3.0

func (c *Client) GetUpStat(mid interface{}) (*GetUpStatResponse, error)

GetUpStat 获取up主状态数 https://api.bilibili.com/x/space/upstat

func (*Client) GetUserCard added in v0.2.0

func (c *Client) GetUserCard(mid interface{}, photo bool) (*GetUserCardResponse, error)

GetUserCard 用户名片信息 https://api.bilibili.com/x/web-interface/card

mid 用户mid
photo 是否请求用户主页头像

func (*Client) GetUserFollowers added in v0.3.1

func (c *Client) GetUserFollowers(mid interface{}, ps int, pn int) (*RelationUserResponse, error)

GetUserFollowers 查询用户粉丝列表 https://api.bilibili.com/x/relation/followers mid 用户ID ps 每页大小 pn 页码 注意:查询别的用户粉丝数上限为250

func (*Client) GetUserFollowings added in v0.3.1

func (c *Client) GetUserFollowings(mid interface{}, orderType string, ps int, pn int) (*RelationUserResponse, error)

GetUserFollowings 查询用户关注列表 https://api.bilibili.com/x/relation/followings mid 用户ID orderType 排序方式 按照关注顺序排列:留空 按照最常访问排列:attention ps 每页大小 pn 页码 注意:查询别的用户关注数上限为250

func (*Client) GetUserFollowingsV2 added in v0.3.1

func (c *Client) GetUserFollowingsV2(mid interface{}, ps int, pn int) (*RelationUserResponse, error)

GetUserFollowingsV2 查询用户关注列表 https://app.biliapi.net/x/v2/relation/followings mid 用户ID ps 每页大小 pn 页码 注意:仅可查看前 5 页 可以获取已设置可见性隐私的关注列表

func (*Client) GetUserInfo added in v0.2.0

func (c *Client) GetUserInfo(mid interface{}) (*GetUserInfoResponse, error)

GetUserInfo 用户空间详细信息 https://api.bilibili.com/x/space/wbi/acc/info

func (*Client) GetVideoRank added in v0.3.5

func (c *Client) GetVideoRank(tid int) ([]*Video, error)

GetVideoRank 获取视频排行榜 tid 分区ID 0 则不分区

func (*Client) GetWhispers added in v0.3.1

func (c *Client) GetWhispers() (*RelationUserResponse, error)

GetWhispers 查询悄悄关注列表 https://api.bilibili.com/x/relation/whispers mid 目标用户ID ps 每页大小 pn 页码 只能查看自己的悄悄关注,total字段不返回,list 返回全部

func (*Client) HasCoinVideo added in v0.3.5

func (c *Client) HasCoinVideo(id string) (int, error)

HasCoinVideo 判断视频是否已经投币 id 视频ID av号或者bv号 返回已投的硬币数量

func (*Client) HasLikeVideo added in v0.3.5

func (c *Client) HasLikeVideo(id string) (int, error)

HasLikeVideo 判断视频是否已经点赞 id 视频ID av号或者bv号 返回 0 未点赞 1 已点赞

func (*Client) LikeVideo added in v0.3.5

func (c *Client) LikeVideo(id string) error

LikeVideo 点赞视频

func (*Client) LoginWithQrCode

func (c *Client) LoginWithQrCode()

LoginWithQrCode 登陆这一步必须成功,否则后续接口无法访问

func (*Client) Logout added in v0.3.4

func (c *Client) Logout() (string, error)

Logout 退出登陆 会返回重定向链接

func (*Client) ModifyRelation added in v0.3.2

func (c *Client) ModifyRelation(mid interface{}, act int, reSrc int) error

ModifyRelation 操作用户关系 https://api.bilibili.com/x/relation/modify mid 目标用户mid act 操作代码

1 关注
2 取关
3 悄悄关注
4 取消悄悄关注
5 拉黑
6 取消拉黑
7 踢出粉丝

reSrc 关注来源

11 空间
14 视频
115 文章
222 活动页面

func (*Client) MoveUsersToRelationTags added in v0.3.3

func (c *Client) MoveUsersToRelationTags(mids []string, beforeTagIds []int, afterTagIds []int) error

MoveUsersToRelationTags 复制成员到分组 https://api.bilibili.com/x/relation/tags/moveUsers mids 用户ID tagIds 分组ID

func (*Client) QueryRelationTagByUser added in v0.3.3

func (c *Client) QueryRelationTagByUser(mid interface{}) (map[string]string, error)

QueryRelationTagByUser 查询用户所在的分组 https://api.bilibili.com/x/relation/tag/user mid 用户ID 返回的 key 是分组ID, value 是分组名称

func (*Client) RefreshAuthInfo added in v0.3.5

func (c *Client) RefreshAuthInfo() error

RefreshAuthInfo 刷新token信息

func (*Client) SearchUserFollowings added in v0.3.1

func (c *Client) SearchUserFollowings(mid interface{}, name string, ps int, pn int) (*RelationUserResponse, error)

SearchUserFollowings 搜索用户关注列表 https://api.bilibili.com/x/relation/followings/search mid 目标用户ID name 搜索关键词 ps 每页大小 pn 页码

func (*Client) ShareVideo added in v0.3.5

func (c *Client) ShareVideo(id string) (int, error)

ShareVideo 分享视频 id 视频ID av号或者bv号 返回该视频的分享数

func (*Client) SubmitVideo

func (c *Client) SubmitVideo(req *SubmitRequest) (*SubmitResponse, error)

SubmitVideo 视频投稿 https://member.bilibili.com/x/vu/web/add/v3

func (*Client) TripleVideo added in v0.3.5

func (c *Client) TripleVideo(id string) (*TripleVideoResponse, error)

TripleVideo 一键三连 id 视频ID av号或者bv号

func (*Client) UnBlock added in v0.3.3

func (c *Client) UnBlock(mid interface{}) error

UnBlock 取消拉黑

func (*Client) UnFollow added in v0.3.3

func (c *Client) UnFollow(mid interface{}) error

UnFollow 取关用户

func (*Client) UnLikeVideo added in v0.3.5

func (c *Client) UnLikeVideo(id string) error

UnLikeVideo 取消点赞

func (*Client) UnWhisperFollow added in v0.3.3

func (c *Client) UnWhisperFollow(mid interface{}) error

UnWhisperFollow 取消悄悄关注

func (*Client) UpdateRelationTag added in v0.3.3

func (c *Client) UpdateRelationTag(tagId int, name string) error

UpdateRelationTag 更新分组 https://api.bilibili.com/x/relation/tag/update tagId 分组ID name 分组新名称

func (*Client) UploadCover

func (c *Client) UploadCover(imageData []byte) (*UploadCoverResponse, error)

UploadCover 上传封面 https://member.bilibili.com/x/vu/web/cover/up

func (*Client) UploadCoverFromDisk added in v0.3.0

func (c *Client) UploadCoverFromDisk(imagePath string) (*UploadCoverResponse, error)

UploadCoverFromDisk 从本地磁盘上传封面 imagePath 图片路径

func (*Client) UploadCoverFromHTTP added in v0.3.0

func (c *Client) UploadCoverFromHTTP(url string) (*UploadCoverResponse, error)

UploadCoverFromHTTP 从http链接上传封面

func (*Client) UploadCoverFromReader added in v0.3.0

func (c *Client) UploadCoverFromReader(reader io.Reader) (*UploadCoverResponse, error)

UploadCoverFromReader ...

func (*Client) UploadVideo

func (c *Client) UploadVideo(filename string, content []byte) (*SubmitVideo, error)

UploadVideo 视频上传,filename 文件名 content 视频内容

func (*Client) UploadVideoFromDisk added in v0.2.2

func (c *Client) UploadVideoFromDisk(videoPath string) (*SubmitVideo, error)

UploadVideoFromDisk 从本地磁盘上传视频 videoPath 视频路径

func (*Client) UploadVideoFromHTTP added in v0.2.2

func (c *Client) UploadVideoFromHTTP(filename string, url string) (*SubmitVideo, error)

UploadVideoFromHTTP 从http链接上传文件

func (*Client) UploadVideoFromReader added in v0.2.2

func (c *Client) UploadVideoFromReader(filename string, reader io.Reader) (*SubmitVideo, error)

UploadVideoFromReader ...

func (*Client) WhisperFollow added in v0.3.3

func (c *Client) WhisperFollow(mid interface{}) error

WhisperFollow 悄悄关注

type Code added in v0.3.3

type Code int
const (
	// CodeSuccess 成功
	CodeSuccess Code = 0
	// CodeCsrfFailed csrf校验失败
	CodeCsrfFailed Code = -111
	// CodeUnLogin 账号未登录
	CodeUnLogin Code = -101
	// CodeRequestError 请求错误
	CodeRequestError Code = -400
	// CodePermissionDenied 没有权限
	CodePermissionDenied Code = 22104
	// CodeUnFollowed 未关注
	CodeUnFollowed Code = 22105
)

type CookieInfo added in v0.3.5

type CookieInfo struct {
	Refresh   bool  `json:"refresh"`
	Timestamp int64 `json:"timestamp"`
}

CookieInfo ...

type CreateRelationTagResponse added in v0.3.3

type CreateRelationTagResponse struct {
	TagId int `json:"tagid"`
}

CreateRelationTagResponse 创建分组

type DescV2 added in v0.3.5

type DescV2 struct {
	RawText string `json:"raw_text"` // 简介内容 type=1时显示原文 type=2时显示'@'+raw_text+' '并链接至biz_id的主页
	Type    int    `json:"type"`     // 类型 1:普通,2:@他人
	BizId   int64  `json:"biz_id"`   // 被@用户的mid	=0,当type=1
}

type Dimension added in v0.3.5

type Dimension struct {
	Width  int `json:"width"`  // 宽度
	Height int `json:"height"` // 高度
	Rotate int `json:"rotate"` // 是否将宽高对换 0 正常 1 对换
}

type ExpReward added in v0.3.5

type ExpReward struct {
	Login        bool `json:"login"`         // 每日登陆 true 已完成 false 未完成 完成奖励5经验
	Watch        bool `json:"watch"`         // 每日观看 true 已完成 false 未完成 完成奖励5经验
	Coins        int  `json:"coins"`         // 每日投币所奖励的经验 上限50 注:该值更新存在延迟 大概延迟几秒钟
	Share        bool `json:"share"`         // 每日分享 true 已完成 false 未完成 完成奖励5经验
	Email        bool `json:"email"`         // 绑定邮箱 false 未完成 true 已完成 首次完成奖励20经验
	Tel          bool `json:"tel"`           // 绑定手机号 false 未完成 true 已完成 首次完成奖励100经验
	SafeQuestion bool `json:"safe_question"` // 设置密保问题 false 未完成 true 已完成 首次完成奖励30经验
	IdentifyCard bool `json:"identify_card"` // 实名认证 false 未完成 true 已完成 首次完成奖励50经验
}

ExpReward 每日经验奖励状态

type GetCoinResponse added in v0.2.0

type GetCoinResponse struct {
	Money float64 `json:"money"`
}

GetCoinResponse 用户硬币信息

type GetDocUploadCountResponse added in v0.3.0

type GetDocUploadCountResponse struct {
	AllCount   int `json:"all_count"`   // 相簿总数 以下3个之和
	DrawCount  int `json:"draw_count"`  // 发布绘画数
	PhotoCount int `json:"photo_count"` // 发布摄影数
	DailyCount int `json:"daily_count"` // 发布日常(图片动态)数
}

GetDocUploadCountResponse 相簿投稿数

type GetLatestVideoResponse added in v0.3.5

type GetLatestVideoResponse struct {
	Archives []*Video `json:"archives"`
	Page     struct {
		Count int `json:"count"` // 总数
		Num   int `json:"num"`   // 当前页码
		Size  int `json:"size"`  // 每页项数
	} `json:"page"`
}

GetLatestVideoResponse ...

type GetMyInfoResponse added in v0.2.0

type GetMyInfoResponse struct {
	Mid            int64  `json:"mid"`             // mid
	Name           string `json:"name"`            // 昵称
	Sex            string `json:"sex"`             // 性别 男 女 保密
	Face           string `json:"face"`            // 头像图片url
	Sign           string `json:"sign"`            // 签名
	Rank           int    `json:"rank"`            // 10000
	Level          int    `json:"level"`           // 当前等级 0-6
	JoinTime       int    `json:"jointime"`        // 0 ?
	Moral          int    `json:"moral"`           // 节操 默认70
	Silence        int    `json:"silence"`         // 封禁状态 0 正常 1 被封
	EmailStatus    int    `json:"email_status"`    // 已验证邮箱 0 未验证 1 已验证
	TelStatus      int    `json:"tel_status"`      // 已验证手机号 0 未验证 1 已验证
	Identification int    `json:"identification"`  // 1 ?
	Birthday       int64  `json:"birthday"`        // 生日
	IsTourist      int    `json:"is_tourist"`      // 0 ?
	IsFakeAccount  int    `json:"is_fake_account"` // 0 ?
	PinPrompting   int    `json:"pin_prompting"`   // 0 ?
	IsDeleted      int    `json:"is_deleted"`      // 0 ?
	InRegAudit     int    `json:"in_reg_audit"`    // ?
	IsRipUser      bool   `json:"is_rip_user"`     // ?
	Profession     struct {
		ID              int    `json:"id"`
		Name            string `json:"name"`
		ShowName        string `json:"show_name"`
		IsShow          int    `json:"is_show"`
		CategoryOne     string `json:"category_one"`
		RealName        string `json:"realname"`
		Title           string `json:"title"`
		Department      string `json:"department"`
		CertificateNo   string `json:"certificate_no"`
		CertificateShow bool   `json:"certificate_show"`
	} `json:"profession"`
	FaceNft        int `json:"face_nft"`
	FaceNftNew     int `json:"face_nft_new"`
	IsSeniorMember int `json:"is_senior_member"`
	Honours        struct {
		Mid    int64 `json:"mid"`
		Colour struct {
			Dark   string `json:"dark"`
			Normal string `json:"normal"`
		} `json:"colour"`
		Tags interface{} `json:"tags"`
	} `json:"honours"`
	DigitalID   string `json:"digital_id"`
	DigitalType int    `json:"digital_type"`
	Attestation struct {
		Type       int `json:"type"`
		CommonInfo struct {
			Title       string `json:"title"`
			Prefix      string `json:"prefix"`
			PrefixTitle string `json:"prefix_title"`
		} `json:"common_info"`
		SpliceInfo struct {
			Title string `json:"title"`
		} `json:"splice_info"`
		Icon string `json:"icon"`
		Desc string `json:"desc"`
	} `json:"attestation"`
	ExpertInfo struct {
		Title string `json:"title"`
	} `json:"expert_info"`
	LevelExp struct {
		CurrentLevel int   `json:"current_level"`
		CurrentMin   int   `json:"current_min"`
		CurrentExp   int   `json:"current_exp"`
		NextExp      int   `json:"next_exp"`
		LevelUp      int64 `json:"level_up"`
	} `json:"level_exp"`
	Coins     float64 `json:"coins"`     // 硬币
	Following int     `json:"following"` // 粉丝数
	Follower  int     `json:"follower"`  // 粉丝数
}

GetMyInfoResponse 登陆用户个人详细信息

type GetPopularVideoListResponse added in v0.3.5

type GetPopularVideoListResponse struct {
	List   []*Video `json:"list"`
	NoMore bool     `json:"no_more"`
}

GetPopularVideoListResponse ...

type GetRelationStatResponse added in v0.3.0

type GetRelationStatResponse struct {
	Mid       int64 `json:"mid"`
	Following int   `json:"following"` // 关注数
	Whisper   int   `json:"whisper"`   // 悄悄关注数 需要登陆
	Black     int   `json:"black"`     // 黑名单数 需要登陆
	Follower  int   `json:"follower"`  // 粉丝数
}

GetRelationStatResponse 用户关系状态

type GetUpStatResponse added in v0.3.0

type GetUpStatResponse struct {
	Archive struct {
		EnableVT int `json:"enable_vt"`
		View     int `json:"view"` // 视频播放量
		VT       int `json:"vt"`
	} `json:"archive"`
	Article struct {
		View int `json:"view"` // 专栏阅读量
	} `json:"article"`
	Likes int `json:"likes"` // 点赞量
}

GetUpStatResponse up主状态

type GetUploadIDResponse

type GetUploadIDResponse struct {
	OK       int    `json:"OK"`
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	UploadID string `json:"upload_id"`
}

GetUploadIDResponse ...

type GetUserCardResponse added in v0.2.0

type GetUserCardResponse struct {
	Card struct {
		Mid         string        `json:"mid"`           // mid
		Name        string        `json:"name"`          // 昵称
		Approve     bool          `json:"approve"`       // ?
		Sex         string        `json:"sex"`           // 性别 男 女 保密
		Rank        string        `json:"rank"`          // 等级
		Face        string        `json:"face"`          // 用户头像链接
		FaceNft     int           `json:"face_nft"`      // 是否是nft头像 0 否 1 是
		FaceNftType int           `json:"face_nft_type"` // nft头像类别?
		DisplayRank string        `json:"DisplayRank"`   // ?
		RegTime     int64         `json:"regtime"`       // ?
		SpaceSta    int           `json:"spacesta"`      // ?
		Birthday    string        `json:"birthday"`      // 空
		Place       string        `json:"place"`         // 空
		Description string        `json:"description"`   // 空
		Article     int           `json:"article"`       // 0
		Attentions  []interface{} `json:"attentions"`    // 空
		Fans        int           `json:"fans"`          // 粉丝数
		Friend      int           `json:"friend"`        // 关注数
		Attention   int           `json:"attention"`     // 关注数
		Sign        string        `json:"sign"`          // 签名
		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"`
		Pendant struct {
			Pid               int    `json:"pid"`
			Name              string `json:"name"`
			Expire            int    `json:"expire"`
			ImageEnhance      string `json:"image_enhance"`
			ImageEnhanceFrame string `json:"image_enhance_frame"`
		} `json:"pendant"`
		Nameplate struct {
			Nid        int    `json:"nid"`
			Name       string `json:"name"`
			Image      string `json:"image"`
			ImageSmall string `json:"image_small"`
			Level      string `json:"level"`
			Condition  string `json:"condition"`
		} `json:"nameplate"`
		Official struct {
			Role  int    `json:"role"`
			Title string `json:"title"`
			Desc  string `json:"desc"`
			Type  int    `json:"type"`
		} `json:"Official"`
		OfficialVerify struct {
			Type int    `json:"type"`
			Desc string `json:"desc"`
		} `json:"official_verify"`
		VIP struct {
			Type       int   `json:"type"`
			Status     int   `json:"status"`
			DueDate    int64 `json:"due_date"`
			VipPayType int   `json:"vip_pay_type"`
			ThemeType  int   `json:"theme_type"`
			Label      struct {
				Path                  string `json:"path"`
				Text                  string `json:"text"`
				LabelTheme            string `json:"label_theme"`
				TextColor             string `json:"text_color"`
				BgStyle               int    `json:"bg_style"`
				BgColor               string `json:"bg_color"`
				BorderColor           string `json:"border_color"`
				UseImgLabel           bool   `json:"use_img_label"`
				ImgLabelUriHans       string `json:"img_label_uri_hans"`
				ImgLabelUriHant       string `json:"img_label_uri_hant"`
				ImgLabelUriHansStatic string `json:"img_label_uri_hans_static"`
				ImgLabelUriHantStatic string `json:"img_label_uri_hant_static"`
			} `json:"label"`
			AvatarSubscript    int    `json:"avatar_subscript"`
			NicknameColor      string `json:"nickname_color"`
			Role               int    `json:"role"`
			AvatarSubscriptUrl string `json:"avatar_subscript_url"`
			TVVIPStatus        int    `json:"tv_vip_status"`
			TVVIPPayType       int    `json:"tv_vip_pay_type"`
			TVDueDate          int64  `json:"tv_due_date"`
			VIPType            int    `json:"vipType"`
			VIPStatus          int    `json:"vipStatus"`
		} `json:"vip"`
		IsSeniorMember int `json:"is_senior_member"`
	} `json:"card"` // 卡片信息
	Space struct {
		SImg string `json:"s_img"`
		LImg string `json:"l_img"`
	} `json:"space"`
	Following    bool `json:"following"`     // 是否关注此用户 需登陆
	ArchiveCount int  `json:"archive_count"` // 用户稿件数
	ArticleCount int  `json:"article_count"` // ?
	Follower     int  `json:"follower"`      // 粉丝数
	LikeNum      int  `json:"like_num"`      // 点赞数
}

GetUserCardResponse 用户名片信息

type GetUserInfoResponse added in v0.2.0

type GetUserInfoResponse struct {
	Mid         int64   `json:"mid"`           // mid
	Name        string  `json:"name"`          // 昵称
	Sex         string  `json:"sex"`           // 性别 男 女 保密
	Face        string  `json:"face"`          // 头像链接
	FaceNft     int     `json:"face_nft"`      // 是否为NFT头像 0 不是 1 是
	FaceNftType int     `json:"face_nft_type"` // nft头像类型?
	Sign        string  `json:"sign"`          // 签名
	Rank        int     `json:"rank"`          // 用户权限等级 5000 0级未答题 10000 普通会员 20000 字幕君 25000 VIP 30000 真.职人 32000管理员
	Level       int     `json:"level"`         // 当前等级 0-6 级
	JoinTime    int     `json:"jointime"`      // 注册时间 此接口返回恒为0
	Moral       int     `json:"moral"`         // 节操值 此接口返回恒为0
	Silence     int     `json:"silence"`       // 封禁状态 0 正常 1 被封
	Coins       float64 `json:"coins"`         // 硬币数 需要登陆,只能查看自己的,默认为0
	FansBadge   bool    `json:"fans_badge"`    // 是否具有粉丝勋章 false 无 true 有
	FansMedal   struct {
		Show  bool        `json:"show"`
		Wear  bool        `json:"wear"`
		Medal interface{} `json:"medal"`
	} `json:"fans_medal"`
	Official struct {
		Role  int    `json:"role"`
		Title string `json:"title"`
		Desc  string `json:"desc"`
		Type  int    `json:"type"`
	} `json:"official"`
	VIP struct {
		Type      int   `json:"type"`
		Status    int   `json:"status"`
		DueDate   int64 `json:"due_date"`
		PayType   int   `json:"vip_pay_type"`
		ThemeType int   `json:"theme_type"`
		Label     struct {
			Path                  string `json:"path"`
			Text                  string `json:"text"`
			LabelTheme            string `json:"label_theme"`
			TextColor             string `json:"text_color"`
			BgStyle               int    `json:"bg_style"`
			BgColor               string `json:"bg_color"`
			BorderColor           string `json:"border_color"`
			UseImgLabel           bool   `json:"use_img_label"`
			ImgLabelUriHans       string `json:"img_label_uri_hans"`
			ImgLabelUriHant       string `json:"img_label_uri_hant"`
			ImgLabelUriHansStatic string `json:"img_label_uri_hans_static"`
			ImgLabelUriHantStatic string `json:"img_label_uri_hant_static"`
		} `json:"label"`
		AvatarSubscript    int    `json:"avatar_subscript"`
		NicknameColor      string `json:"nickname_color"`
		Role               int    `json:"role"`
		AvatarSubscriptUrl string `json:"avatar_subscript_url"`
		TVVIPStatus        int    `json:"tv_vip_status"`
		TVVIPPayType       int    `json:"tv_vip_pay_type"`
		TVDueDate          int64  `json:"tv_due_date"`
	} `json:"vip"`
	Pendant struct {
		Pid               int    `json:"pid"`
		Name              string `json:"name"`
		Image             string `json:"image"`
		Expire            int    `json:"expire"`
		ImageEnhance      string `json:"image_enhance"`
		ImageEnhanceFrame string `json:"image_enhance_frame"`
	} `json:"pendant"`
	Nameplate struct {
		Nid        int    `json:"nid"`
		Name       string `json:"name"`
		Image      string `json:"image"`
		ImageSmall string `json:"image_small"`
		Level      string `json:"level"`
		Condition  string `json:"condition"`
	} `json:"nameplate"`
	UserHonourInfo struct {
		Mid    int64    `json:"mid"`
		Colour []string `json:"colour"`
		Tags   []string `json:"tags"`
	} `json:"user_honour_info"`
	IsFollowed bool     `json:"is_followed"` // 是否关注此用户 true 已关注 false 未关注,需要登陆,未登陆恒为false
	TopPhoto   string   `json:"top_photo"`   // 主页头像链接
	Theme      struct{} `json:"theme"`       // ?
	SysNotice  struct{} `json:"sys_notice"`  // 系统通知
	LiveRoom   struct {
		RoomStatus    int    `json:"roomStatus"`
		LiveStatus    int    `json:"liveStatus"`
		URL           string `json:"url"`
		Title         string `json:"title"`
		Cover         string `json:"cover"`
		RoomId        int    `json:"roomid"`
		RoundStatus   int    `json:"roundStatus"`
		BroadcastType int    `json:"broadcast_type"`
		WatchedShow   struct {
			Switch       bool   `json:"switch"`
			Num          int    `json:"num"`
			TextSmall    string `json:"text_small"`
			TextLarge    string `json:"text_large"`
			Icon         string `json:"icon"`
			IconLocation string `json:"icon_location"`
			IconWeb      string `json:"icon_web"`
		} `json:"watched_show"`
	} `json:"live_room"`
	Birthday string `json:"birthday"` // 生日,如设置为隐私为空
	School   struct {
		Name string `json:"name"`
	} `json:"school"`
	Profession struct {
		Name       string `json:"name"`
		Department string `json:"department"`
		Title      string `json:"title"`
		IsShow     int    `json:"is_show"`
	} `json:"profession"`
	Tags   interface{} `json:"tags"` // 个人标签
	Series struct {
		UserUpgradeStatus int  `json:"user_upgrade_status"`
		ShowUpgradeWindow bool `json:"show_upgrade_window"`
	} `json:"series"`
	IsSeniorMember int         `json:"is_senior_member"` // 是否为硬核会员 0 否 1 是
	MCNInfo        interface{} `json:"mcn_info"`         // ?
	GaiaResType    int         `json:"gaia_res_type"`    // ?
	GaiaData       interface{} `json:"gaia_data"`        // ?
	IsRisk         bool        `json:"is_risk"`          // ?
	Elec           struct {
		ShowInfo struct {
			Show    bool   `json:"show"`
			State   int    `json:"state"`
			Title   string `json:"title"`
			Icon    string `json:"icon"`
			JumpURL string `json:"jump_url"`
		} `json:"show_info"`
	} `json:"elec"`
	Contract struct {
		IsDisplay       bool `json:"is_display"`
		IsFollowDisplay bool `json:"is_follow_display"`
	} `json:"contract"`
	CertificateShow bool `json:"certificate_show"` // ?
}

GetUserInfoResponse 用户空间信息

type Logger added in v0.2.2

type Logger interface {
	Debug(args ...any)
	Info(args ...any)
	Warn(args ...any)
	Error(args ...any)
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
}

type LogoutResponse added in v0.3.4

type LogoutResponse struct {
	RedirectUrl string `json:"redirectUrl"`
}

LogoutResponse 登出

type NavigationResponse struct {
	AllowanceCount int    `json:"allowance_count"`  // ?
	AnswerStatus   int    `json:"answer_status"`    // ?
	EmailVerified  int    `json:"email_verified"`   // 是否验证邮箱地址,0 未验证 1 已验证
	Face           string `json:"face"`             // 头像
	FaceNFT        int    `json:"face_nft"`         // 是否为NFT头像 0 不是 1 是
	FaceNFTType    int    `json:"face_nft_type"`    // NFT头像类型?
	HasShop        bool   `json:"has_shop"`         // 是否拥有推广商品 true 有 false 无
	IsLogin        bool   `json:"isLogin"`          // 是否已登陆 true 已登陆 false 未登录
	IsJury         bool   `json:"is_jury"`          // 是否是风纪委员 true 是 false 不是
	IsSeniorMember int    `json:"is_senior_member"` // 是否是硬核会员 0 不是 1 是
	LevelInfo      struct {
		CurrentExp   int `json:"current_exp"`
		CurrentLevel int `json:"current_level"`
		CurrentMin   int `json:"current_min"`
		NextExp      int `json:"next_exp"`
	} `json:"level_info"` // 等级信息
	Mid            int64   `json:"mid"`             // 用户 mid
	MobileVerified int     `json:"mobile_verified"` // 是否验证手机号 0 未验证 1 已验证
	Money          float64 `json:"money"`           // 硬币数
	Moral          int     `json:"moral"`           // 当前节操值 上限70
	Official       struct {
		Desc  string `json:"desc"`
		Role  int    `json:"role"`
		Title string `json:"title"`
		Type  int    `json:"type"`
	} `json:"official"` // 认证信息
	OfficialVerify struct {
		Desc string `json:"desc"`
		Type int    `json:"type"`
	} `json:"officialVerify"` // 认证信息2
	Pendant struct {
		Expire            int    `json:"expire"`
		Image             string `json:"image"`
		ImageEnhance      string `json:"image_enhance"`
		ImageEnhanceFrame string `json:"image_enhance_frame"`
		Name              string `json:"name"`
		PID               int    `json:"pid"`
	} `json:"pendant"` // 头像框信息
	Scores  int    `json:"scores"`   // ?
	ShopURL string `json:"shop_url"` // 商品推广页url
	UName   string `json:"uname"`    // 用户昵称
	VIP     struct {
		AvatarSubscript    int    `json:"avatar_subscript"`
		AvatarSubscriptURL string `json:"avatar_subscript_url"`
		DueDate            int64  `json:"due_date"`
		Label              struct {
			BgColor               string `json:"bg_color"`
			BgStyle               int    `json:"bg_style"`
			BorderColor           string `json:"border_color"`
			ImgLabelUriHans       string `json:"img_label_uri_hans"`
			ImgLabelUriHansStatic string `json:"img_label_uri_hans_static"`
			ImgLabelUriHant       string `json:"img_label_uri_hant"`
			ImgLabelUriHantStatic string `json:"img_label_uri_hant_static"`
			LabelTheme            string `json:"label_theme"`
			Path                  string `json:"path"`
			Text                  string `json:"text"`
			TextColor             string `json:"text_color"`
			UseImgLabel           bool   `json:"use_img_label"`
		} `json:"label"`
		NicknameColor string `json:"nickname_color"`
		Role          int    `json:"role"`
		Status        int    `json:"status"`
		ThemeType     int    `json:"theme_type"`
		TvDueDate     int64  `json:"tv_due_date"`
		TvVIPPayType  int    `json:"tv_vip_pay_type"`
		TvVIPStatus   int    `json:"tv_vip_status"`
		Type          int    `json:"type"`
		VIPPayType    int    `json:"vip_pay_type"`
	} `json:"vip"` // 会员信息
	VIPDueDate         int64 `json:"vipDueDate"`           // 会员到期时间 毫秒时间戳
	VIPStatus          int   `json:"vipStatus"`            // 会员开通状态 0 无 1 有
	VIPType            int   `json:"vipType"`              // 会员类型 0 无 1 月度大会员 2 年度及以上大会员
	VIPAvatarSubscript int   `json:"vip_avatar_subscript"` // 是否显示会员图标 0 不显示 1 显示
	VIPLabel           struct {
		BgColor               string `json:"bg_color"`
		BgStyle               int    `json:"bg_style"`
		BorderColor           string `json:"border_color"`
		ImgLabelUriHans       string `json:"img_label_uri_hans"`
		ImgLabelUriHansStatic string `json:"img_label_uri_hans_static"`
		ImgLabelUriHant       string `json:"img_label_uri_hant"`
		ImgLabelUriHantStatic string `json:"img_label_uri_hant_static"`
		LabelTheme            string `json:"label_theme"`
		Path                  string `json:"path"`
		Text                  string `json:"text"`
		TextColor             string `json:"text_color"`
		UseImgLabel           bool   `json:"use_img_label"`
	} `json:"vip_label"` // 会员标签
	VIPNicknameColor string `json:"vip_nickname_color"` // 会员昵称颜色 颜色码
	VIPPayType       int    `json:"vip_pay_type"`       // 会员开通状态 0 无 1 有
	VIPThemeType     int    `json:"vip_theme_type"`     // ?
	Wallet           struct {
		BCoinBalance  int   `json:"bcoin_balance"`
		CouponBalance int   `json:"coupon_balance"`
		CouponDueTime int   `json:"coupon_due_time"`
		Mid           int64 `json:"mid"`
	} `json:"wallet"` // B币钱包信息
	WBIImg struct {
		ImgURL string `json:"img_url"`
		SubURL string `json:"sub_url"`
	} `json:"wbi_img"` // Wbi签名实时口令
}

NavigationResponse for navigation response

type NavigationStatusResponse struct {
	Following    int64 `json:"following"`     // 关注数
	Follower     int64 `json:"follower"`      // 粉丝数
	DynamicCount int64 `json:"dynamic_count"` // 动态数
}

NavigationStatusResponse for navigation status Response

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAuthStorage added in v0.2.6

func WithAuthStorage(storage AuthStorage) Option

func WithDebug added in v0.2.0

func WithDebug(d bool, output ...*os.File) Option

func WithHttpClient

func WithHttpClient(client *http.Client) Option

func WithLogger added in v0.2.2

func WithLogger(logger Logger) Option

func WithRefreshInterval added in v0.3.6

func WithRefreshInterval(interval time.Duration) Option

func WithShowQRCodeFunc added in v0.2.4

func WithShowQRCodeFunc(f func(code *qrcode.QRCode) error) Option

func WithUserAgent

func WithUserAgent(ua string) Option

type Owner added in v0.3.5

type Owner struct {
	Mid  int64  `json:"mid"`  // 用户 mid
	Name string `json:"name"` // 用户名
	Face string `json:"face"` // 用户头像
}

type Page added in v0.3.5

type Page struct {
	Cid       int64      `json:"cid"`       // 分p cid
	Page      int        `json:"page"`      // 分p序号
	From      string     `json:"from"`      // 视频来源 vupload 普通上传 hunan 芒果TV qq 腾讯
	Part      string     `json:"part"`      // 分P标题
	Duration  int        `json:"duration"`  // 分P持续时间 单位秒
	Vid       string     `json:"vid"`       // 站外视频vid
	Weblink   string     `json:"weblink"`   // 站外视频跳转url
	Dimension *Dimension `json:"dimension"` // 当前分P分辨率
}

type PreUploadResponse

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

PreUploadResponse ...

func (*PreUploadResponse) Filename

func (r *PreUploadResponse) Filename() string

func (*PreUploadResponse) Uri

func (r *PreUploadResponse) Uri() string

type QrcodeGenerateResponse

type QrcodeGenerateResponse struct {
	Url       string `json:"url"`
	QrcodeKey string `json:"qrcode_key"`
}

QrcodeGenerateResponse for qrcode generate response

type QrcodePollResponse

type QrcodePollResponse struct {
	Url          string `json:"url"`
	RefreshToken string `json:"refresh_token"`
	Timestamp    int    `json:"timestamp"`
	Code         int    `json:"code"`
	Message      string `json:"message"`
}

QrcodePollResponse for qrcode poll response

type RefreshCookieResponse added in v0.3.5

type RefreshCookieResponse struct {
	Status       int    `json:"status"`
	Message      string `json:"message"`
	RefreshToken string `json:"refresh_token"`
}

RefreshCookieResponse ...

type Relation added in v0.3.3

type Relation struct {
	Mid       int64     `json:"mid"`
	Attribute Attribute `json:"attribute"`
	MTime     int64     `json:"mtime"` // 关注对方时间
	Tag       []int     `json:"tag"`
	Special   int       `json:"special"` // 1 特别关注
}

Relation 关系

type RelationTag added in v0.3.3

type RelationTag struct {
	TagId int    `json:"tagid"` // 0 默认分组 -10 特别关注
	Name  string `json:"name"`  // 分组名称
	Count int    `json:"count"` // 分组成员数
	Tip   string `json:"tip"`   // 提示信息
}

RelationTag 分组标签

type RelationUser added in v0.3.1

type RelationUser struct {
	Mid            int64    `json:"mid"`
	Attribute      int      `json:"attribute"`     // 0 未关注 1 已关注 2 已关注 6 已互粉 128 已拉黑
	Mtime          int      `json:"mtime"`         // 关注对方时间
	Tag            []int    `json:"tag"`           // 分组ID
	Special        int      `json:"special"`       // 特别关注标志 0 否 1 是
	ContractInfo   struct{} `json:"contract_info"` // unknown
	Uname          string   `json:"uname"`
	Face           string   `json:"face"`
	Sign           string   `json:"sign"`
	FaceNft        int      `json:"face_nft"`
	OfficialVerify struct {
		Type  int    `json:"type"` // 1 已认证 -1 无认证
		Desc  string `json:"desc"`
		Role  int    `json:"role"`
		Title string `json:"title"`
	} `json:"official_verify"`
	Vip struct {
		VipType       int    `json:"vipType"`
		VipDueDate    int64  `json:"vipDueDate"`
		DueRemark     string `json:"dueRemark"`
		AccessStatus  int    `json:"accessStatus"`
		VipStatus     int    `json:"vipStatus"`
		VipStatusWarn string `json:"vipStatusWarn"`
		ThemeType     int    `json:"themeType"`
		Label         struct {
			Path        string `json:"path"`
			Text        string `json:"text"`
			LabelTheme  string `json:"label_theme"`
			TextColor   string `json:"text_color"`
			BgStyle     int    `json:"bg_style"`
			BgColor     string `json:"bg_color"`
			BorderColor string `json:"border_color"`
		} `json:"label"`
		AvatarSubscript    int    `json:"avatar_subscript"`
		NicknameColor      string `json:"nickname_color"`
		AvatarSubscriptUrl string `json:"avatar_subscript_url"`
	} `json:"vip"`
	NftIcon   string `json:"nft_icon"`
	RecReason string `json:"rec_reason"`
	TrackId   string `json:"track_id"`
}

type RelationUserResponse added in v0.3.1

type RelationUserResponse struct {
	List      []RelationUser `json:"list"` // 列表
	ReVersion interface{}    `json:"re_version"`
	Total     int            `json:"total"` // 总数
}

RelationUserResponse 用户关系响应

type Rights added in v0.3.5

type Rights struct {
	Bp            int `json:"bp"`             // 是否允许承包
	Elec          int `json:"elec"`           // 是否支持充电
	Download      int `json:"download"`       // 是否允许下载
	Movie         int `json:"movie"`          // 是否电影
	Pay           int `json:"pay"`            // 是否PGC付费
	Hd5           int `json:"hd5"`            // 是否有高码率
	NoReprint     int `json:"no_reprint"`     // 是否显示“禁止转载”标志
	Autoplay      int `json:"autoplay"`       // 是否自动播放
	UgcPay        int `json:"ugc_pay"`        // 是否UGC付费
	IsCooperation int `json:"is_cooperation"` // 是否为联合投稿
	UgcPayPreview int `json:"ugc_pay_preview"`
	NoBackground  int `json:"no_background"`
	ArcPay        int `json:"arc_pay"`
	PayFreeWatch  int `json:"pay_free_watch"`
}

type Stat added in v0.3.5

type Stat struct {
	Aid      int64 `json:"aid"`      // avid
	View     int   `json:"view"`     // 播放数
	Danmaku  int   `json:"danmaku"`  // 弹幕数
	Reply    int   `json:"reply"`    // 评论数
	Favorite int   `json:"favorite"` // 收藏数
	Coin     int   `json:"coin"`     // 投币数
	Share    int   `json:"share"`    // 分享数
	NowRank  int   `json:"now_rank"` // 当前排名
	HisRank  int   `json:"his_rank"` // 历史最高排行
	Like     int   `json:"like"`     // 点赞数
	Dislike  int   `json:"dislike"`  // 点踩数 恒为0
	Vt       int   `json:"vt"`
	Vv       int   `json:"vv"`
}

type SubmitRequest

type SubmitRequest struct {
	Cover            string         `json:"cover"`              // 封面 必须
	Title            string         `json:"title"`              // 标题 必须
	Copyright        int            `json:"copyright"`          // 是否原创 必须 1 原创 2 转载
	Source           string         `json:"source"`             // 如果选择转载则 将原视频链接贴这里
	Dtime            int64          `json:"dtime"`              // 设置定时发布时间,时间戳,精确到秒,如不设置则立即发送
	TID              int            `json:"tid"`                // 分类ID 必须
	Tag              string         `json:"tag"`                // 标签 用逗号分隔 必须
	DescFormatID     int            `json:"desc_format_id"`     // ?
	Desc             string         `json:"desc"`               // 简介 必须
	Recreate         int            `json:"recreate"`           // 二创视频 -1 不允许二创 1 允许二创
	Dynamic          string         `json:"dynamic"`            // 粉丝动态 ?
	Interactive      int            `json:"interactive"`        // 是否是合作视频 ?
	Videos           []*SubmitVideo `json:"videos"`             // 视频 必须
	ActReserveCreate int            `json:"act_reserve_create"` // 允许二创 ?
	NoDisturbance    int            `json:"no_disturbance"`     // ?
	NoReprint        int            `json:"no_reprint"`         // ?
	Subtitle         struct {
		Open int    `json:"open"`
		Lan  string `json:"lan"`
	} `json:"subtitle"` // ?
	Dolby         int    `json:"dolby"`          // 杜比音效
	LosslessMusic int    `json:"lossless_music"` // 无损音质 ?
	WebOS         int    `json:"web_os"`         // ?2
	CSRF          string `json:"csrf"`           // bili_jct
}

SubmitRequest ...

type SubmitResponse

type SubmitResponse struct {
	Aid  int64  `json:"aid"`
	Bvid string `json:"bvid"`
}

SubmitResponse ...

type SubmitVideo added in v0.3.5

type SubmitVideo struct {
	Filename string `json:"filename"`
	Title    string `json:"title"`
	Desc     string `json:"desc"`
	CID      int    `json:"cid"`
}

SubmitVideo 投稿视频

type TripleVideoResponse added in v0.3.5

type TripleVideoResponse struct {
	Like     bool `json:"like"`     // 是否点赞成功
	Coin     bool `json:"coin"`     // 是否投币成功
	Fav      bool `json:"fav"`      // 是否收藏成功
	Multiply int  `json:"multiply"` // 投币数量
}

TripleVideoResponse ...

type UploadCheckResponse

type UploadCheckResponse struct {
	OK       int    `json:"OK"`
	Bucket   string `json:"bucket"`
	Etag     string `json:"etag"`
	Key      string `json:"key"`
	Location string `json:"location"`
}

UploadCheckResponse ...

type UploadCoverResponse

type UploadCoverResponse struct {
	Url string `json:"url"`
}

UploadCoverResponse ...

type Video

type Video struct {
	Aid         int         `json:"aid"`       // avid
	Videos      int         `json:"videos"`    // 分P总数
	Tid         int         `json:"tid"`       // 分区ID
	Tname       string      `json:"tname"`     // 子分区名称
	Copyright   int         `json:"copyright"` // 视频类型 1 原创 2 转载
	Pic         string      `json:"pic"`       // 封面url
	Title       string      `json:"title"`     // 标题
	Pubdate     int64       `json:"pubdate"`   // 发布时间 秒级时间戳
	Ctime       int64       `json:"ctime"`     // 投稿时间 秒级时间戳
	Desc        string      `json:"desc"`      // 简介
	DescV2      []*DescV2   `json:"desc_v2"`   // 新版视频简介
	State       int         `json:"state"`     // 状态
	Duration    int         `json:"duration"`  // 所有分P总时长 单位秒
	Rights      *Rights     `json:"rights"`    // 视频属性标志
	Owner       *Owner      `json:"owner"`     // Up主信息
	Stat        Stat        `json:"stat"`      // 视频状态数
	Dynamic     string      `json:"dynamic"`   // 视频同步发布的的动态的文字内容
	Cid         int64       `json:"cid"`       // 视频1P cid
	Dimension   *Dimension  `json:"dimension"` // 视频1P分辨率
	Pages       []*Page     `json:"pages"`     // 视频分P列表
	ShortLink   string      `json:"short_link_v2"`
	UpFromV2    int         `json:"up_from_v2"`
	FirstFrame  string      `json:"first_frame"`
	PubLocation string      `json:"pub_location"`
	Bvid        string      `json:"bvid"` // bvid
	SeasonType  int         `json:"season_type"`
	IsOgv       bool        `json:"is_ogv"`
	OgvInfo     interface{} `json:"ogv_info"`
	EnableVt    int         `json:"enable_vt"`
}

type VideoZone added in v0.2.3

type VideoZone struct {
	Name string
	Code string
	TID  int
	Desc string
	Url  string
}

type VideoZoneGroup added in v0.2.3

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

func (*VideoZoneGroup) GetMainZone added in v0.2.5

func (group *VideoZoneGroup) GetMainZone() *VideoZone

GetMainZone 返回主分区

func (*VideoZoneGroup) GetSubZones added in v0.2.5

func (group *VideoZoneGroup) GetSubZones() map[int]*VideoZone

GetSubZones 返回所有子分区

func (*VideoZoneGroup) GetVideoZone added in v0.2.5

func (group *VideoZoneGroup) GetVideoZone(tid int) *VideoZone

GetVideoZone 查询分区详细信息, 如果该分区不存在该tid则会返回主分区

func (*VideoZoneGroup) MainTid added in v0.2.5

func (group *VideoZoneGroup) MainTid() int

MainTid 返回分区的主tid

func (*VideoZoneGroup) RandomTid added in v0.2.5

func (group *VideoZoneGroup) RandomTid() int

RandomTid 返回一个随机分区tid

Directories

Path Synopsis
internal
net

Jump to

Keyboard shortcuts

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