feat: 新版贴子 API
This commit is contained in:
parent
b9daed6d59
commit
c82ed238fe
|
|
@ -63,17 +63,13 @@ fun buildAppPosInfo(): AppPosInfo {
|
||||||
fun buildCommonRequest(
|
fun buildCommonRequest(
|
||||||
context: Context = App.INSTANCE,
|
context: Context = App.INSTANCE,
|
||||||
clientVersion: ClientVersion = ClientVersion.TIEBA_V11
|
clientVersion: ClientVersion = ClientVersion.TIEBA_V11
|
||||||
): CommonRequest = buildCommonRequest(context, clientVersion.version)
|
): CommonRequest = when (clientVersion) {
|
||||||
|
ClientVersion.TIEBA_V11 ->
|
||||||
fun buildCommonRequest(
|
CommonRequest(
|
||||||
context: Context = App.INSTANCE,
|
|
||||||
clientVersion: String,
|
|
||||||
): CommonRequest {
|
|
||||||
return CommonRequest(
|
|
||||||
BDUSS = AccountUtil.getBduss(),
|
BDUSS = AccountUtil.getBduss(),
|
||||||
_client_id = ClientUtils.clientId ?: RetrofitTiebaApi.randomClientId,
|
_client_id = ClientUtils.clientId ?: RetrofitTiebaApi.randomClientId,
|
||||||
_client_type = 2,
|
_client_type = 2,
|
||||||
_client_version = clientVersion,
|
_client_version = clientVersion.version,
|
||||||
_os_version = "${Build.VERSION.SDK_INT}",
|
_os_version = "${Build.VERSION.SDK_INT}",
|
||||||
_phone_imei = MobileInfoUtil.getIMEI(context),
|
_phone_imei = MobileInfoUtil.getIMEI(context),
|
||||||
_timestamp = System.currentTimeMillis(),
|
_timestamp = System.currentTimeMillis(),
|
||||||
|
|
@ -92,4 +88,29 @@ fun buildCommonRequest(
|
||||||
sample_id = ClientUtils.sampleId,
|
sample_id = ClientUtils.sampleId,
|
||||||
stoken = AccountUtil.getSToken(),
|
stoken = AccountUtil.getSToken(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ClientVersion.TIEBA_V12 ->
|
||||||
|
CommonRequest(
|
||||||
|
BDUSS = AccountUtil.getBduss(),
|
||||||
|
_client_id = ClientUtils.clientId ?: RetrofitTiebaApi.randomClientId,
|
||||||
|
_client_type = 2,
|
||||||
|
_client_version = clientVersion.version,
|
||||||
|
_os_version = "${Build.VERSION.SDK_INT}",
|
||||||
|
_phone_imei = MobileInfoUtil.getIMEI(context),
|
||||||
|
_timestamp = System.currentTimeMillis(),
|
||||||
|
brand = Build.BRAND,
|
||||||
|
c3_aid = UIDUtil.getAid(),
|
||||||
|
cuid = CuidUtils.getNewCuid(),
|
||||||
|
cuid_galaxy2 = CuidUtils.getNewCuid(),
|
||||||
|
cuid_gid = "",
|
||||||
|
from = "1024324o",
|
||||||
|
is_teenager = 0,
|
||||||
|
lego_lib_version = "3.0.0",
|
||||||
|
model = Build.MODEL,
|
||||||
|
net_type = "1",
|
||||||
|
oaid = UIDUtil.getOAID(),
|
||||||
|
pversion = "1.0.3",
|
||||||
|
sample_id = ClientUtils.sampleId,
|
||||||
|
stoken = AccountUtil.getSToken(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ import com.huanchengfly.tieba.post.api.models.*
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecommendResponse
|
import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecommendResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
|
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.pbPage.PbPageResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse
|
import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse
|
import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
||||||
|
|
@ -1225,4 +1226,16 @@ interface ITiebaApi {
|
||||||
fun userProfileFlow(
|
fun userProfileFlow(
|
||||||
uid: Long
|
uid: Long
|
||||||
): Flow<ProfileResponse>
|
): Flow<ProfileResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴子页(Flow)
|
||||||
|
*
|
||||||
|
* @param threadId 贴子 ID
|
||||||
|
*/
|
||||||
|
fun pbPageFlow(
|
||||||
|
threadId: Long,
|
||||||
|
page: Int,
|
||||||
|
sortType: Int = 0,
|
||||||
|
forumId: Long? = null,
|
||||||
|
): Flow<PbPageResponse>
|
||||||
}
|
}
|
||||||
|
|
@ -1005,4 +1005,62 @@ object MixedTiebaApiImpl : ITiebaApi {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun pbPageFlow(
|
||||||
|
threadId: Long,
|
||||||
|
page: Int,
|
||||||
|
sortType: Int,
|
||||||
|
forumId: Long?
|
||||||
|
): Flow<PbPageResponse> {
|
||||||
|
return RetrofitTiebaApi.OFFICIAL_PROTOBUF_TIEBA_V12_API.pbPageFlow(
|
||||||
|
buildProtobufRequestBody(
|
||||||
|
PbPageRequest(
|
||||||
|
PbPageRequestData(
|
||||||
|
common = buildCommonRequest(clientVersion = ClientVersion.TIEBA_V12),
|
||||||
|
kz = threadId,
|
||||||
|
ad_param = com.huanchengfly.tieba.post.api.models.protos.pbPage.AdParam(
|
||||||
|
load_count = 0,
|
||||||
|
refresh_count = 1,
|
||||||
|
is_req_ad = 1
|
||||||
|
),
|
||||||
|
app_pos = buildAppPosInfo(),
|
||||||
|
back = 0,
|
||||||
|
banner = 1,
|
||||||
|
broadcast_id = 0,
|
||||||
|
floor_rn = 4,
|
||||||
|
floor_sort_type = 1,
|
||||||
|
forum_id = forumId ?: 0,
|
||||||
|
from_push = 0,
|
||||||
|
from_smart_frs = 0,
|
||||||
|
immersion_video_comment_source = 0,
|
||||||
|
is_comm_reverse = 0,
|
||||||
|
is_fold_comment_req = 0,
|
||||||
|
is_jumpfloor = 0,
|
||||||
|
jumpfloor_num = 0,
|
||||||
|
need_repost_recommend_forum = 0,
|
||||||
|
obj_locate = "",
|
||||||
|
obj_param1 = "2",
|
||||||
|
obj_source = "",
|
||||||
|
ori_ugc_type = 0,
|
||||||
|
pb_rn = 0,
|
||||||
|
pid = 0,
|
||||||
|
pn = page,
|
||||||
|
q_type = 1,
|
||||||
|
r = sortType,
|
||||||
|
rn = 15,
|
||||||
|
s_model = 0,
|
||||||
|
scr_dip = App.ScreenInfo.DENSITY.toDouble(),
|
||||||
|
scr_h = getScreenHeight(),
|
||||||
|
scr_w = getScreenWidth(),
|
||||||
|
source_type = 2,
|
||||||
|
st_type = "personalize_page",
|
||||||
|
thread_type = 0,
|
||||||
|
weipost = 0,
|
||||||
|
with_floor = 1
|
||||||
|
)
|
||||||
|
),
|
||||||
|
clientVersion = ClientVersion.TIEBA_V12
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.huanchengfly.tieba.post.api.retrofit.interfaces
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecommendResponse
|
import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecommendResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
|
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.pbPage.PbPageResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse
|
import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse
|
import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
||||||
|
|
@ -53,4 +54,9 @@ interface OfficialProtobufTiebaApi {
|
||||||
fun profileFlow(
|
fun profileFlow(
|
||||||
@Body body: MyMultipartBody,
|
@Body body: MyMultipartBody,
|
||||||
): Flow<ProfileResponse>
|
): Flow<ProfileResponse>
|
||||||
|
|
||||||
|
@POST("/c/f/pb/page?cmd=302001&format=protobuf")
|
||||||
|
fun pbPageFlow(
|
||||||
|
@Body body: MyMultipartBody,
|
||||||
|
): Flow<PbPageResponse>
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ package tieba.pbPage;
|
||||||
option java_package = "com.huanchengfly.tieba.post.api.models.protos.pbPage";
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos.pbPage";
|
||||||
|
|
||||||
message AdParam {
|
message AdParam {
|
||||||
int32 load_count = 1;
|
optional int32 load_count = 1;
|
||||||
int32 refresh_count = 2;
|
int32 refresh_count = 2;
|
||||||
string yoga_lib_version = 3;
|
string yoga_lib_version = 3;
|
||||||
int32 is_req_ad = 4;
|
int32 is_req_ad = 4;
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,18 @@ import "CommonRequest.proto";
|
||||||
import "PbPage/AdParam.proto";
|
import "PbPage/AdParam.proto";
|
||||||
|
|
||||||
message PbPageRequestData {
|
message PbPageRequestData {
|
||||||
int32 pb_rn = 1;
|
optional int32 pb_rn = 1;
|
||||||
int32 mark = 2;
|
int32 mark = 2;
|
||||||
int32 back = 3;
|
optional int32 back = 3;
|
||||||
int64 kz = 4;
|
int64 kz = 4;
|
||||||
int32 lz = 5;
|
int32 lz = 5;
|
||||||
int32 r = 6;
|
optional int32 r = 6;
|
||||||
int64 pid = 7;
|
optional int64 pid = 7;
|
||||||
int32 with_floor = 8;
|
int32 with_floor = 8;
|
||||||
int32 floor_rn = 9;
|
int32 floor_rn = 9;
|
||||||
int32 weipost = 10;
|
optional int32 weipost = 10;
|
||||||
int32 message_id = 11;
|
int32 message_id = 11;
|
||||||
int32 s_model = 12;
|
optional int32 s_model = 12;
|
||||||
int32 rn = 13;
|
int32 rn = 13;
|
||||||
int32 scr_w = 14;
|
int32 scr_w = 14;
|
||||||
int32 scr_h = 15;
|
int32 scr_h = 15;
|
||||||
|
|
@ -29,7 +29,7 @@ message PbPageRequestData {
|
||||||
int32 q_type = 17;
|
int32 q_type = 17;
|
||||||
int32 pn = 18;
|
int32 pn = 18;
|
||||||
string st_type = 19;
|
string st_type = 19;
|
||||||
int32 thread_type = 20;
|
optional int32 thread_type = 20;
|
||||||
int32 banner = 21;
|
int32 banner = 21;
|
||||||
int32 arround = 22;
|
int32 arround = 22;
|
||||||
int32 last = 23;
|
int32 last = 23;
|
||||||
|
|
@ -42,9 +42,9 @@ message PbPageRequestData {
|
||||||
int64 st_task = 30;
|
int64 st_task = 30;
|
||||||
int32 issdk = 31;
|
int32 issdk = 31;
|
||||||
string query_word = 32;
|
string query_word = 32;
|
||||||
int32 is_comm_reverse = 33;
|
optional int32 is_comm_reverse = 33;
|
||||||
int32 is_jumpfloor = 34;
|
optional int32 is_jumpfloor = 34;
|
||||||
int32 jumpfloor_num = 35;
|
optional int32 jumpfloor_num = 35;
|
||||||
string da_idfa = 42;
|
string da_idfa = 42;
|
||||||
string platform = 43;
|
string platform = 43;
|
||||||
uint64 jid = 44;
|
uint64 jid = 44;
|
||||||
|
|
@ -52,31 +52,31 @@ message PbPageRequestData {
|
||||||
string jfrom = 46;
|
string jfrom = 46;
|
||||||
string yuelaou_locate = 47;
|
string yuelaou_locate = 47;
|
||||||
string yuelaou_params = 48;
|
string yuelaou_params = 48;
|
||||||
string obj_source = 50;
|
optional string obj_source = 50;
|
||||||
string obj_locate = 51;
|
optional string obj_locate = 51;
|
||||||
string obj_param1 = 52;
|
optional string obj_param1 = 52;
|
||||||
AppPosInfo app_pos = 53;
|
AppPosInfo app_pos = 53;
|
||||||
uint32 from_smart_frs = 54;
|
optional uint32 from_smart_frs = 54;
|
||||||
string feed_nid = 55;
|
string feed_nid = 55;
|
||||||
int64 forum_id = 56;
|
optional int64 forum_id = 56;
|
||||||
int32 need_repost_recommend_forum = 57;
|
optional int32 need_repost_recommend_forum = 57;
|
||||||
AdParam ad_param = 58;
|
AdParam ad_param = 58;
|
||||||
int32 need_log = 59;
|
int32 need_log = 59;
|
||||||
string call_url = 60;
|
string call_url = 60;
|
||||||
string shoubai_cuid = 61;
|
string shoubai_cuid = 61;
|
||||||
string ori_ugc_nid = 62;
|
string ori_ugc_nid = 62;
|
||||||
string ori_ugc_tid = 63;
|
string ori_ugc_tid = 63;
|
||||||
int32 ori_ugc_type = 65;
|
optional int32 ori_ugc_type = 65;
|
||||||
string ori_ugc_vid = 66;
|
string ori_ugc_vid = 66;
|
||||||
string ad_context_list = 68;
|
string ad_context_list = 68;
|
||||||
string up_schema = 69;
|
string up_schema = 69;
|
||||||
int32 from_push = 71;
|
optional int32 from_push = 71;
|
||||||
string ad_ext_params = 72;
|
string ad_ext_params = 72;
|
||||||
int64 broadcast_id = 73;
|
optional int64 broadcast_id = 73;
|
||||||
int32 floor_sort_type = 74;
|
int32 floor_sort_type = 74;
|
||||||
int32 source_type = 75;
|
int32 source_type = 75;
|
||||||
int32 immersion_video_comment_source = 76;
|
optional int32 immersion_video_comment_source = 76;
|
||||||
AppTransmitData app_transmit_data = 77;
|
AppTransmitData app_transmit_data = 77;
|
||||||
int32 is_fold_comment_req = 78;
|
optional int32 is_fold_comment_req = 78;
|
||||||
int32 is_edit_comment_req = 79;
|
int32 is_edit_comment_req = 79;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue