Skip to content

Commit

Permalink
Change aid/cid/epid/sessionid to uint64_t (#349)
Browse files Browse the repository at this point in the history
* Change cid aid seasonid epid mid to uint64_t

* Correct mid definition
  • Loading branch information
xfangfang authored May 30, 2024
1 parent ab79071 commit 5e6558d
Show file tree
Hide file tree
Showing 41 changed files with 197 additions and 197 deletions.
8 changes: 4 additions & 4 deletions wiliwili/include/activity/player_activity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class BasePlayerActivity : public brls::Activity, public VideoDetail {
void setRelationButton(bool liked, bool coin, bool favorite);

// 展示收藏列表对话框
void showCollectionDialog(int64_t id, int videoType);
void showCollectionDialog(uint64_t id, int videoType);

// 展示投币对话框
void showCoinDialog(size_t aid);
void showCoinDialog(uint64_t aid);

// 设置清晰度
void setVideoQuality();
Expand Down Expand Up @@ -141,7 +141,7 @@ class BasePlayerActivity : public brls::Activity, public VideoDetail {

class PlayerActivity : public BasePlayerActivity {
public:
PlayerActivity(const std::string& bvid, unsigned int cid = 0, int progress = -1);
PlayerActivity(const std::string& bvid, uint64_t cid = 0, int progress = -1);

void setProgress(int p) override;
int getProgress() override;
Expand Down Expand Up @@ -202,7 +202,7 @@ class PlayerSeasonActivity : public BasePlayerActivity {
void onCastPlayUrl(const bilibili::VideoUrlResult& result) override;

// 正在播放的情况下切换到新的番剧
void playSeason(size_t season_id);
void playSeason(uint64_t season_id);

size_t getAid() override;

Expand Down
58 changes: 29 additions & 29 deletions wiliwili/include/api/bilibili.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class BilibiliClient {
* @param callback
* @param error
*/
static void get_my_collection_list(int64_t mid, int index = 1, int num = 20, int type = 1,
static void get_my_collection_list(uint64_t mid, int index = 1, int num = 20, int type = 1,
const std::function<void(CollectionListResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand Down Expand Up @@ -227,31 +227,31 @@ class BilibiliClient {
const ErrorCallback& error = nullptr);

/// get user's upload videos
static void get_user_videos(int64_t mid, int pn, int ps,
static void get_user_videos(uint64_t mid, int pn, int ps,
const std::function<void(UserUploadedVideoResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get user's dynamic videos
static void get_user_videos2(int64_t mid, int pn, int ps,
static void get_user_videos2(uint64_t mid, int pn, int ps,
const std::function<void(UserDynamicVideoResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get season detail by seasonID
static void get_season_detail(int seasonID, int epID = 0,
static void get_season_detail(uint64_t seasonID, uint64_t epID = 0,
const std::function<void(SeasonResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 获取番剧相关推荐
static void get_season_recommend(size_t seasonID,
static void get_season_recommend(uint64_t seasonID,
const std::function<void(SeasonRecommendWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 获取番剧的播放进度
static void get_season_status(size_t seasonID, const std::function<void(SeasonStatusResult)>& callback,
static void get_season_status(uint64_t seasonID, const std::function<void(SeasonStatusResult)>& callback,
const ErrorCallback& error);

/// get video detail by aid
static void get_video_detail(int aid, const std::function<void(VideoDetailResult)>& callback = nullptr,
static void get_video_detail(uint64_t aid, const std::function<void(VideoDetailResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get video detail by bvid
Expand All @@ -264,10 +264,10 @@ class BilibiliClient {
const ErrorCallback& error = nullptr);

/// 获取分P详情 (主要内容为cc字幕)
static void get_page_detail(int aid, int cid, const std::function<void(VideoPageResult)>& callback = nullptr,
static void get_page_detail(uint64_t aid, uint64_t cid, const std::function<void(VideoPageResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

static void get_page_detail(const std::string& bvid, int cid,
static void get_page_detail(const std::string& bvid, uint64_t cid,
const std::function<void(VideoPageResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand All @@ -277,7 +277,7 @@ class BilibiliClient {
const ErrorCallback& error = nullptr);

/// get video pagelist by aid
static void get_video_pagelist(int aid, const std::function<void(VideoDetailPageListResult)>& callback = nullptr,
static void get_video_pagelist(uint64_t aid, const std::function<void(VideoDetailPageListResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get video pagelist by bvid
Expand All @@ -286,7 +286,7 @@ class BilibiliClient {
const ErrorCallback& error = nullptr);

/// get video url by aid & cid
static void get_video_url(int aid, int cid, int qn = 64,
static void get_video_url(uint64_t aid, uint64_t cid, int qn = 64,
const std::function<void(VideoUrlResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand All @@ -295,17 +295,17 @@ class BilibiliClient {
* @param oid aid 或 epic
* @param type 如果传入的普通视频的 aid 则为 1;如果是番剧类的 epid 则为 2
*/
static void get_video_url_cast(int oid, int cid, int type, int qn = 64, const std::string& csrf = "",
static void get_video_url_cast(uint64_t oid, uint64_t cid, int type, int qn = 64, const std::string& csrf = "",
const std::function<void(VideoUrlResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get video url by bvid & cid
static void get_video_url(const std::string& bvid, int cid, int qn = 64,
static void get_video_url(const std::string& bvid, uint64_t cid, int qn = 64,
const std::function<void(VideoUrlResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get season video url by cid
static void get_season_url(int cid, int qn = 64, const std::function<void(VideoUrlResult)>& callback = nullptr,
static void get_season_url(uint64_t cid, int qn = 64, const std::function<void(VideoUrlResult)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// get live video url by roomid
Expand Down Expand Up @@ -453,10 +453,10 @@ class BilibiliClient {
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/// 视频页 获取单个视频播放人数
static void get_video_online(int aid, int cid, const std::function<void(VideoOnlineTotal)>& callback = nullptr,
static void get_video_online(uint64_t aid, uint64_t cid, const std::function<void(VideoOnlineTotal)>& callback = nullptr,
const ErrorCallback& error = nullptr);

static void get_video_online(const std::string& bvid, int cid,
static void get_video_online(const std::string& bvid, uint64_t cid,
const std::function<void(VideoOnlineTotal)>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand All @@ -465,38 +465,38 @@ class BilibiliClient {
const std::function<void(VideoRelation)>& callback = nullptr,
const ErrorCallback& error = nullptr);

static void get_video_relation(size_t epid, const std::function<void(VideoEpisodeRelation)>& callback = nullptr,
static void get_video_relation(uint64_t epid, const std::function<void(VideoEpisodeRelation)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 视频页 获取弹幕的xml文件
static void get_danmaku(unsigned int cid, const std::function<void(std::string)>& callback = nullptr,
static void get_danmaku(uint64_t cid, const std::function<void(std::string)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 视频页 获取字幕
static void get_subtitle(const std::string& link, const std::function<void(SubtitleData)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 视频页 获取高能进度条
static void get_highlight_progress(unsigned int cid,
static void get_highlight_progress(uint64_t cid,
const std::function<void(VideoHighlightProgress)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 视频页 上报历史记录
static void report_history(const std::string& mid, const std::string& access_key, unsigned int aid,
unsigned int cid, int type = 3, unsigned int progress = 0, unsigned int duration = 0,
unsigned int sid = 0, unsigned int epid = 0,
static void report_history(const std::string& mid, const std::string& access_key, uint64_t aid,
uint64_t cid, int type = 3, unsigned int progress = 0, unsigned int duration = 0,
uint64_t sid = 0, uint64_t epid = 0,
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/// 直播页 上报观看记录
static void report_live_history(int room, const std::string& csrf, const std::function<void()>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 点赞
static void be_agree(const std::string& access_key, int aid, bool is_like,
static void be_agree(const std::string& access_key, uint64_t aid, bool is_like,
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/// 投币
static void add_coin(const std::string& access_key, int aid, unsigned int coin_number, bool is_like,
static void add_coin(const std::string& access_key, uint64_t aid, unsigned int coin_number, bool is_like,
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/// 投币经验值
Expand All @@ -507,7 +507,7 @@ class BilibiliClient {
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/// 追剧或取消追剧
static void follow_season(const std::string& access_key, size_t season, bool follow = true,
static void follow_season(const std::string& access_key, uint64_t season, bool follow = true,
const std::function<void()>& callback = nullptr, const ErrorCallback& error = nullptr);

/**
Expand All @@ -520,7 +520,7 @@ class BilibiliClient {
* @param callback 若成功 进行回调
* @param error 若失败返回失败原因
*/
static void add_resource(const std::string& access_key, int rid, int type, const std::string& add_ids,
static void add_resource(const std::string& access_key, uint64_t rid, int type, const std::string& add_ids,
const std::string& del_ids, const std::function<void()>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand Down Expand Up @@ -553,12 +553,12 @@ class BilibiliClient {
* @param error
*/
static void get_collection_list_all(
int rid, int type, std::string mid,
uint64_t rid, int type, const std::string& mid,
const std::function<void(SimpleCollectionListResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 三连
static void triple_like(const std::string& access_key, int aid, const std::function<void()>& callback = nullptr,
static void triple_like(const std::string& access_key, uint64_t aid, const std::function<void()>& callback = nullptr,
const ErrorCallback& error = nullptr);

/// 搜索页 获取搜索视频内容
Expand All @@ -579,7 +579,7 @@ class BilibiliClient {
const ErrorCallback& error = nullptr);

/// 动态页 获取全部关注用户的最近动态 图文
static void dynamic_article(const unsigned int page, const std::string& offset = "", const int64_t mid = 0,
static void dynamic_article(const unsigned int page, const std::string& offset = "", uint64_t mid = 0,
const std::function<void(DynamicArticleListResultWrapper)>& callback = nullptr,
const ErrorCallback& error = nullptr);

Expand Down
4 changes: 2 additions & 2 deletions wiliwili/include/api/bilibili/result/dynamic_article.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DynamicArticleModuleArchive {
public:
std::string aid, bvid, cover, title, duration_text;
std::string desc; // 可能为 null
unsigned int epid{}; // 可能为 null
uint64_t epid{}; // 可能为 null
int type{}; // 1: UGC
VideoSimpleStateResultV2 stat;
};
Expand Down Expand Up @@ -99,7 +99,7 @@ class DynamicArticleModuleLiveCardInfo {
int room_id{};
std::string title;
// int area_id{}, parent_area_id{};
// int64_t uid{};
// uint64_t uid{};
// int live_status{}, online{};
ShowInfo watched_show;
};
Expand Down
4 changes: 2 additions & 2 deletions wiliwili/include/api/bilibili/result/dynamic_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace bilibili {

class DynamicVideoResult {
public:
int aid = 0;
uint64_t aid = 0;
std::string bvid;
std::string pic;
std::string title;
Expand Down Expand Up @@ -66,7 +66,7 @@ class DynamicUpResult {
bool has_update;
std::string face;
std::string uname;
int64_t mid;
uint64_t mid;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DynamicUpResult, has_update, face, uname, mid);

Expand Down
6 changes: 3 additions & 3 deletions wiliwili/include/api/bilibili/result/home_hots_all_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

#pragma once

#include "nlohmann/json.hpp"
#include "bilibili/util/json.hpp"
#include "user_result.h"
#include "home_result.h"

namespace bilibili {

class HotsAllVideoResult {
public:
int aid;
uint64_t aid;
std::string bvid;
int cid;
uint64_t cid;
std::string pic;
std::string title;
int duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

#pragma once

#include "nlohmann/json.hpp"
#include "bilibili/util/json.hpp"
#include "user_result.h"
#include "home_result.h"

namespace bilibili {

class HotsHistoryVideoResult {
public:
int aid;
uint64_t aid;
std::string bvid;
int cid;
uint64_t cid;
std::string pic;
std::string title;
int duration;
Expand Down
8 changes: 4 additions & 4 deletions wiliwili/include/api/bilibili/result/home_hots_rank.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "nlohmann/json.hpp"
#include "bilibili/util/json.hpp"
#include "user_result.h"
#include "home_result.h"

Expand All @@ -19,7 +19,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsRankPGCConfig, index_show);
class HotsRankPGCVideoResult {
public:
int rank;
int season_id;
uint64_t season_id;
std::string ss_horizontal_cover; //横版封面
std::string cover; //竖版封面
std::string title;
Expand All @@ -40,9 +40,9 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsRankPGCVideoListResultWrapper, note, list

class HotsRankVideoResult {
public:
int aid;
uint64_t aid;
std::string bvid;
int cid;
uint64_t cid;
std::string pic;
std::string title;
int duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "nlohmann/json.hpp"
#include "bilibili/util/json.hpp"
#include "user_result.h"
#include "home_result.h"

Expand All @@ -29,9 +29,9 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsWeeklyResultWrapper, list);

class HotsWeeklyVideoResult {
public:
int aid;
uint64_t aid;
std::string bvid;
int cid;
uint64_t cid;
std::string pic;
std::string title;
int duration;
Expand Down
2 changes: 1 addition & 1 deletion wiliwili/include/api/bilibili/result/home_live_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, LivePlayUrlInfo& nl
class LiveRoomPlayInfo {
public:
int room_id;
int64_t uid;
uint64_t uid;
int live_status;
size_t live_time;
LivePlayUrlInfo playurl_info;
Expand Down
4 changes: 2 additions & 2 deletions wiliwili/include/api/bilibili/result/home_pgc_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PGCItemResult {
std::string title;
std::string desc;
std::string cover;
int season_id;
uint64_t season_id;
std::string bottom_left_badge; // pic link 不是所有都包含此项
std::string bottom_right_badge; // text
std::string badge_info; // pic link
Expand Down Expand Up @@ -82,7 +82,7 @@ class PGCIndexResult {
std::string title;
std::string cover;
int season_type;
int season_id;
uint64_t season_id;
int is_finish;
int media_id;
std::string order; // eg: 800万追番
Expand Down
Loading

0 comments on commit 5e6558d

Please sign in to comment.