diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 97f62379..62bb5f9d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11"] steps: - name: Checkout diff --git a/README.md b/README.md index 04e315dd..2c4dafaf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- GitHub Workflow Status + GitHub Workflow Status PyPI - Version @@ -87,23 +87,22 @@ asyncio.run(main()) ## 客户名单 -

2022.11.20更新 +
2022.12.19更新 | 吧名 | 关注用户数 | 最近29天日均访问量 | 日均主题帖数 | 日均回复数 | | :------------: | :--------: | :----------------: | :----------: | :--------: | -| 抗压背锅 | 4,297,600 | 1,346,462 | 3,602 | 87,919 | -| 孙笑川 | 2,867,558 | 571,445 | 5,317 | 151,279 | -| lol半价 | 1,976,938 | 102,687 | 342 | 5,162 | -| 宫漫 | 1,385,076 | 33,628 | 159 | 1,768 | -| 逆水寒ol | 719,939 | 27,041 | 103 | 1,915 | -| 新孙笑川 | 470,700 | 53,570 | 650 | 15,080 | -| vtuber | 218,818 | 10,819 | 57 | 686 | -| asoul | 156,629 | 11,946 | 102 | 506 | -| 嘉然 | 58,623 | 14,485 | 125 | 1,561 | -| 向晚 | 30,468 | 11,727 | 98 | 1,235 | -| 贝拉 | 21,735 | 8,458 | 38 | 565 | -| 乃琳 | 17,262 | 6,120 | 36 | 546 | -| vtuber自由讨论 | 17,023 | 4,058 | 2 | 50 | -| asoul一个魂儿 | 14,281 | 878 | 4 | 15 | +| 抗压背锅 | 4,384,814 | 1,078,903 | 1,695 | 70,473 | +| 孙笑川 | 3,027,960 | 710,954 | 6,395 | 203,962 | +| lol半价 | 1,989,272 | 89,995 | 295 | 4,258 | +| 宫漫 | 1,429,875 | 41,061 | 164 | 2,320 | +| 逆水寒ol | 730,945 | 26,510 | 112 | 1,753 | +| 新孙笑川 | 496,177 | 38,547 | 323 | 13,033 | +| vtuber | 219,792 | 9,916 | 59 | 682 | +| asoul | 156,286 | 11,013 | 89 | 518 | +| 嘉然 | 59,061 | 12,000 | 95 | 1,231 | +| 向晚 | 30,725 | 9,238 | 71 | 888 | +| 贝拉 | 21,747 | 7,653 | 34 | 545 | +| 乃琳 | 17,323 | 4,782 | 28 | 420 | +| vtuber自由讨论 | 17,083 | 3,948 | 2 | 45 |
diff --git a/aiotieba/__init__.py b/aiotieba/__init__.py index 70122e34..091fea22 100644 --- a/aiotieba/__init__.py +++ b/aiotieba/__init__.py @@ -63,7 +63,7 @@ VoteInfo, ) -__version__ = "2.9.6" +__version__ = "2.9.7" if os.name == 'posix': import signal diff --git a/aiotieba/client.py b/aiotieba/client.py index 2faef7a1..37edb62b 100644 --- a/aiotieba/client.py +++ b/aiotieba/client.py @@ -278,7 +278,7 @@ class Client(object): _use_env_proxy = False - latest_version: ClassVar[str] = "12.32.3.0" # 这是目前的最新版本 + latest_version: ClassVar[str] = "12.34.1.0" # 这是目前的最新版本 # no_fold_version: ClassVar[str] = "12.12.1.0" # 这是最后一个回复列表不发生折叠的版本 post_version: ClassVar[str] = "9.1.0.0" # 发帖使用极速版 @@ -1737,9 +1737,9 @@ async def get_homepage( req_proto = ProfileReqIdl_pb2.ProfileReqIdl() req_proto.data.common._client_version = self.latest_version + req_proto.data.need_post_count = 1 req_proto.data.friend_uid_portrait = user.portrait if with_threads: - req_proto.data.need_post_count = 1 req_proto.data.common._client_type = 2 req_proto.data.pn = 1 req_proto.data.rn = 20 diff --git a/aiotieba/protobuf/ThreadInfo.proto b/aiotieba/protobuf/ThreadInfo.proto index 27a698ce..8223d570 100644 --- a/aiotieba/protobuf/ThreadInfo.proto +++ b/aiotieba/protobuf/ThreadInfo.proto @@ -16,6 +16,7 @@ message ThreadInfo { int32 is_good = 10; int32 is_voice_thread = 15; User author = 18; + int32 thread_type = 26; int64 fid = 27; string fname = 28; int32 is_livepost = 30; diff --git a/aiotieba/protobuf/ThreadInfo_pb2.py b/aiotieba/protobuf/ThreadInfo_pb2.py index 75514146..bab3c1ae 100644 --- a/aiotieba/protobuf/ThreadInfo_pb2.py +++ b/aiotieba/protobuf/ThreadInfo_pb2.py @@ -17,7 +17,7 @@ from . import Agree_pb2 as Agree__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10ThreadInfo.proto\x1a\nUser.proto\x1a\x0ePollInfo.proto\x1a\x0fPbContent.proto\x1a\x0b\x41gree.proto\"\xad\t\n\nThreadInfo\x12\n\n\x02id\x18\x01 \x01(\x03\x12\r\n\x05title\x18\x03 \x01(\t\x12\x11\n\treply_num\x18\x04 \x01(\x05\x12\x10\n\x08view_num\x18\x05 \x01(\x05\x12\x15\n\rlast_time_int\x18\x07 \x01(\x05\x12\x0e\n\x06is_top\x18\t \x01(\x05\x12\x0f\n\x07is_good\x18\n \x01(\x05\x12\x17\n\x0fis_voice_thread\x18\x0f \x01(\x05\x12\x15\n\x06\x61uthor\x18\x12 \x01(\x0b\x32\x05.User\x12\x0b\n\x03\x66id\x18\x1b \x01(\x03\x12\r\n\x05\x66name\x18\x1c \x01(\t\x12\x13\n\x0bis_livepost\x18\x1e \x01(\x05\x12\x15\n\rfirst_post_id\x18( \x01(\x03\x12\x13\n\x0b\x63reate_time\x18- \x01(\x05\x12\x0f\n\x07post_id\x18\x34 \x01(\x03\x12\x11\n\tauthor_id\x18\x38 \x01(\x03\x12\r\n\x05is_ad\x18; \x01(\r\x12\x1c\n\tpoll_info\x18J \x01(\x0b\x32\t.PollInfo\x12\x1e\n\x16is_godthread_recommend\x18U \x01(\x05\x12\x15\n\x05\x61gree\x18~ \x01(\x0b\x32\x06.Agree\x12\x12\n\tshare_num\x18\x87\x01 \x01(\x05\x12\x39\n\x12origin_thread_info\x18\x8d\x01 \x01(\x0b\x32\x1c.ThreadInfo.OriginThreadInfo\x12\'\n\x12\x66irst_post_content\x18\x8e\x01 \x03(\x0b\x32\n.PbContent\x12\x18\n\x0fis_share_thread\x18\x8f\x01 \x01(\x05\x12\x0f\n\x06tab_id\x18\xaf\x01 \x01(\x05\x12\x13\n\nis_deleted\x18\xb5\x01 \x01(\x05\x12\x14\n\x0bis_frs_mask\x18\xc6\x01 \x01(\x05\x12\x30\n\rcustom_figure\x18\xd3\x01 \x01(\x0b\x32\x18.ThreadInfo.CustomFigure\x12.\n\x0c\x63ustom_state\x18\xd4\x01 \x01(\x0b\x32\x17.ThreadInfo.CustomState\x1a\x97\x03\n\x10OriginThreadInfo\x12\r\n\x05title\x18\x01 \x01(\t\x12\x31\n\x05media\x18\x02 \x03(\x0b\x32\".ThreadInfo.OriginThreadInfo.Media\x12\r\n\x05\x66name\x18\x04 \x01(\t\x12\x0b\n\x03tid\x18\x05 \x01(\t\x12\x0b\n\x03\x66id\x18\x07 \x01(\x03\x12\x31\n\x05voice\x18\x0c \x03(\x0b\x32\".ThreadInfo.OriginThreadInfo.Voice\x12\x1b\n\x07\x63ontent\x18\x0e \x03(\x0b\x32\n.PbContent\x12\x1c\n\tpoll_info\x18\x15 \x01(\x0b\x32\t.PollInfo\x12\x0b\n\x03pid\x18\x19 \x01(\x03\x1as\n\x05Media\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x13\n\x0b\x62ig_cdn_src\x18\x02 \x01(\t\x12\x12\n\norigin_src\x18\x03 \x01(\t\x12\x0f\n\x07\x63\x64n_src\x18\x04 \x01(\t\x12\r\n\x05\x62size\x18\x0c \x01(\t\x12\x13\n\x0borigin_size\x18\x10 \x01(\r\x1a(\n\x05Voice\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x11\n\tvoice_md5\x18\x03 \x01(\t\x1a(\n\x0c\x43ustomFigure\x12\x18\n\x10\x62\x61\x63kground_value\x18\x03 \x01(\t\x1a\x1e\n\x0b\x43ustomState\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\tb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10ThreadInfo.proto\x1a\nUser.proto\x1a\x0ePollInfo.proto\x1a\x0fPbContent.proto\x1a\x0b\x41gree.proto\"\xc2\t\n\nThreadInfo\x12\n\n\x02id\x18\x01 \x01(\x03\x12\r\n\x05title\x18\x03 \x01(\t\x12\x11\n\treply_num\x18\x04 \x01(\x05\x12\x10\n\x08view_num\x18\x05 \x01(\x05\x12\x15\n\rlast_time_int\x18\x07 \x01(\x05\x12\x0e\n\x06is_top\x18\t \x01(\x05\x12\x0f\n\x07is_good\x18\n \x01(\x05\x12\x17\n\x0fis_voice_thread\x18\x0f \x01(\x05\x12\x15\n\x06\x61uthor\x18\x12 \x01(\x0b\x32\x05.User\x12\x13\n\x0bthread_type\x18\x1a \x01(\x05\x12\x0b\n\x03\x66id\x18\x1b \x01(\x03\x12\r\n\x05\x66name\x18\x1c \x01(\t\x12\x13\n\x0bis_livepost\x18\x1e \x01(\x05\x12\x15\n\rfirst_post_id\x18( \x01(\x03\x12\x13\n\x0b\x63reate_time\x18- \x01(\x05\x12\x0f\n\x07post_id\x18\x34 \x01(\x03\x12\x11\n\tauthor_id\x18\x38 \x01(\x03\x12\r\n\x05is_ad\x18; \x01(\r\x12\x1c\n\tpoll_info\x18J \x01(\x0b\x32\t.PollInfo\x12\x1e\n\x16is_godthread_recommend\x18U \x01(\x05\x12\x15\n\x05\x61gree\x18~ \x01(\x0b\x32\x06.Agree\x12\x12\n\tshare_num\x18\x87\x01 \x01(\x05\x12\x39\n\x12origin_thread_info\x18\x8d\x01 \x01(\x0b\x32\x1c.ThreadInfo.OriginThreadInfo\x12\'\n\x12\x66irst_post_content\x18\x8e\x01 \x03(\x0b\x32\n.PbContent\x12\x18\n\x0fis_share_thread\x18\x8f\x01 \x01(\x05\x12\x0f\n\x06tab_id\x18\xaf\x01 \x01(\x05\x12\x13\n\nis_deleted\x18\xb5\x01 \x01(\x05\x12\x14\n\x0bis_frs_mask\x18\xc6\x01 \x01(\x05\x12\x30\n\rcustom_figure\x18\xd3\x01 \x01(\x0b\x32\x18.ThreadInfo.CustomFigure\x12.\n\x0c\x63ustom_state\x18\xd4\x01 \x01(\x0b\x32\x17.ThreadInfo.CustomState\x1a\x97\x03\n\x10OriginThreadInfo\x12\r\n\x05title\x18\x01 \x01(\t\x12\x31\n\x05media\x18\x02 \x03(\x0b\x32\".ThreadInfo.OriginThreadInfo.Media\x12\r\n\x05\x66name\x18\x04 \x01(\t\x12\x0b\n\x03tid\x18\x05 \x01(\t\x12\x0b\n\x03\x66id\x18\x07 \x01(\x03\x12\x31\n\x05voice\x18\x0c \x03(\x0b\x32\".ThreadInfo.OriginThreadInfo.Voice\x12\x1b\n\x07\x63ontent\x18\x0e \x03(\x0b\x32\n.PbContent\x12\x1c\n\tpoll_info\x18\x15 \x01(\x0b\x32\t.PollInfo\x12\x0b\n\x03pid\x18\x19 \x01(\x03\x1as\n\x05Media\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x13\n\x0b\x62ig_cdn_src\x18\x02 \x01(\t\x12\x12\n\norigin_src\x18\x03 \x01(\t\x12\x0f\n\x07\x63\x64n_src\x18\x04 \x01(\t\x12\r\n\x05\x62size\x18\x0c \x01(\t\x12\x13\n\x0borigin_size\x18\x10 \x01(\r\x1a(\n\x05Voice\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x11\n\tvoice_md5\x18\x03 \x01(\t\x1a(\n\x0c\x43ustomFigure\x12\x18\n\x10\x62\x61\x63kground_value\x18\x03 \x01(\t\x1a\x1e\n\x0b\x43ustomState\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\tb\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'ThreadInfo_pb2', globals()) @@ -25,15 +25,15 @@ DESCRIPTOR._options = None _THREADINFO._serialized_start=79 - _THREADINFO._serialized_end=1276 - _THREADINFO_ORIGINTHREADINFO._serialized_start=795 - _THREADINFO_ORIGINTHREADINFO._serialized_end=1202 - _THREADINFO_ORIGINTHREADINFO_MEDIA._serialized_start=1045 - _THREADINFO_ORIGINTHREADINFO_MEDIA._serialized_end=1160 - _THREADINFO_ORIGINTHREADINFO_VOICE._serialized_start=1162 - _THREADINFO_ORIGINTHREADINFO_VOICE._serialized_end=1202 - _THREADINFO_CUSTOMFIGURE._serialized_start=1204 - _THREADINFO_CUSTOMFIGURE._serialized_end=1244 - _THREADINFO_CUSTOMSTATE._serialized_start=1246 - _THREADINFO_CUSTOMSTATE._serialized_end=1276 + _THREADINFO._serialized_end=1297 + _THREADINFO_ORIGINTHREADINFO._serialized_start=816 + _THREADINFO_ORIGINTHREADINFO._serialized_end=1223 + _THREADINFO_ORIGINTHREADINFO_MEDIA._serialized_start=1066 + _THREADINFO_ORIGINTHREADINFO_MEDIA._serialized_end=1181 + _THREADINFO_ORIGINTHREADINFO_VOICE._serialized_start=1183 + _THREADINFO_ORIGINTHREADINFO_VOICE._serialized_end=1223 + _THREADINFO_CUSTOMFIGURE._serialized_start=1225 + _THREADINFO_CUSTOMFIGURE._serialized_end=1265 + _THREADINFO_CUSTOMSTATE._serialized_start=1267 + _THREADINFO_CUSTOMSTATE._serialized_end=1297 # @@protoc_insertion_point(module_scope) diff --git a/aiotieba/protobuf/User.proto b/aiotieba/protobuf/User.proto index 28393b14..426d3556 100644 --- a/aiotieba/protobuf/User.proto +++ b/aiotieba/protobuf/User.proto @@ -64,4 +64,8 @@ message User { StateInfo personal_state = 9; } VirtualImageInfo virtual_image_info = 136; + message UserGrowth { + uint32 level_id = 1; + } + UserGrowth user_growth = 137; } diff --git a/aiotieba/protobuf/User_pb2.py b/aiotieba/protobuf/User_pb2.py index 2fac0e53..5285f5e3 100644 --- a/aiotieba/protobuf/User_pb2.py +++ b/aiotieba/protobuf/User_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nUser.proto\"\x81\t\n\x04User\x12\n\n\x02id\x18\x02 \x01(\x03\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\tname_show\x18\x04 \x01(\t\x12\x10\n\x08portrait\x18\x05 \x01(\t\x12\x13\n\x0bis_coreuser\x18\x14 \x01(\x05\x12\x10\n\x08level_id\x18\x17 \x01(\x05\x12\x0f\n\x07is_bawu\x18\x19 \x01(\x05\x12\x11\n\tbawu_type\x18\x1a \x01(\t\x12\r\n\x05\x42\x44USS\x18\x1d \x01(\t\x12\x10\n\x08\x66\x61ns_num\x18\x1e \x01(\x05\x12\x13\n\x0b\x63oncern_num\x18\x1f \x01(\x05\x12\x0b\n\x03sex\x18 \x01(\x05\x12\r\n\x05intro\x18\" \x01(\t\x12\x10\n\x08post_num\x18% \x01(\x05\x12\x0e\n\x06tb_age\x18& \x01(\t\x12\x0e\n\x06gender\x18* \x01(\x05\x12!\n\tpriv_sets\x18- \x01(\x0b\x32\x0e.User.PrivSets\x12\x11\n\tis_friend\x18. \x01(\x05\x12&\n\tlikeForum\x18/ \x03(\x0b\x32\x13.User.LikeForumInfo\x12\x13\n\x0bis_guanfang\x18\x34 \x01(\x05\x12\"\n\x07vipInfo\x18= \x01(\x0b\x32\x11.User.UserVipInfo\x12\'\n\x0enew_tshow_icon\x18\x41 \x03(\x0b\x32\x0f.User.TshowInfo\x12\x0f\n\x07is_fans\x18[ \x01(\x05\x12&\n\x0cnew_god_data\x18\x65 \x01(\x0b\x32\x10.User.NewGodInfo\x12\x19\n\x11is_default_avatar\x18j \x01(\x05\x12\x11\n\ttieba_uid\x18x \x01(\t\x12\x12\n\nip_address\x18\x7f \x01(\t\x12\x33\n\x12virtual_image_info\x18\x88\x01 \x01(\x0b\x32\x16.User.VirtualImageInfo\x1a\xab\x01\n\x08PrivSets\x12\x10\n\x08location\x18\x01 \x01(\x05\x12\x0c\n\x04like\x18\x02 \x01(\x05\x12\r\n\x05group\x18\x03 \x01(\x05\x12\x0c\n\x04post\x18\x04 \x01(\x05\x12\x0e\n\x06\x66riend\x18\x05 \x01(\x05\x12\x0c\n\x04live\x18\x06 \x01(\x05\x12\r\n\x05reply\x18\x07 \x01(\x05\x12\x19\n\x11\x62\x61zhu_show_inside\x18\x08 \x01(\x05\x12\x1a\n\x12\x62\x61zhu_show_outside\x18\t \x01(\x05\x1a\x35\n\rLikeForumInfo\x12\x12\n\nforum_name\x18\x01 \x01(\t\x12\x10\n\x08\x66orum_id\x18\x02 \x01(\x04\x1a\x30\n\x0bUserVipInfo\x12\x10\n\x08v_status\x18\x01 \x01(\r\x12\x0f\n\x07v_level\x18\x05 \x01(\r\x1a\x19\n\tTshowInfo\x12\x0c\n\x04name\x18\x02 \x01(\t\x1a\x42\n\nNewGodInfo\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x10\n\x08\x66ield_id\x18\x02 \x01(\r\x12\x12\n\nfield_name\x18\x03 \x01(\t\x1a\x84\x01\n\x10VirtualImageInfo\x12\x1b\n\x13isset_virtual_image\x18\x01 \x01(\x05\x12\x38\n\x0epersonal_state\x18\t \x01(\x0b\x32 .User.VirtualImageInfo.StateInfo\x1a\x19\n\tStateInfo\x12\x0c\n\x04text\x18\x02 \x01(\tb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nUser.proto\"\xc9\t\n\x04User\x12\n\n\x02id\x18\x02 \x01(\x03\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\tname_show\x18\x04 \x01(\t\x12\x10\n\x08portrait\x18\x05 \x01(\t\x12\x13\n\x0bis_coreuser\x18\x14 \x01(\x05\x12\x10\n\x08level_id\x18\x17 \x01(\x05\x12\x0f\n\x07is_bawu\x18\x19 \x01(\x05\x12\x11\n\tbawu_type\x18\x1a \x01(\t\x12\r\n\x05\x42\x44USS\x18\x1d \x01(\t\x12\x10\n\x08\x66\x61ns_num\x18\x1e \x01(\x05\x12\x13\n\x0b\x63oncern_num\x18\x1f \x01(\x05\x12\x0b\n\x03sex\x18 \x01(\x05\x12\r\n\x05intro\x18\" \x01(\t\x12\x10\n\x08post_num\x18% \x01(\x05\x12\x0e\n\x06tb_age\x18& \x01(\t\x12\x0e\n\x06gender\x18* \x01(\x05\x12!\n\tpriv_sets\x18- \x01(\x0b\x32\x0e.User.PrivSets\x12\x11\n\tis_friend\x18. \x01(\x05\x12&\n\tlikeForum\x18/ \x03(\x0b\x32\x13.User.LikeForumInfo\x12\x13\n\x0bis_guanfang\x18\x34 \x01(\x05\x12\"\n\x07vipInfo\x18= \x01(\x0b\x32\x11.User.UserVipInfo\x12\'\n\x0enew_tshow_icon\x18\x41 \x03(\x0b\x32\x0f.User.TshowInfo\x12\x0f\n\x07is_fans\x18[ \x01(\x05\x12&\n\x0cnew_god_data\x18\x65 \x01(\x0b\x32\x10.User.NewGodInfo\x12\x19\n\x11is_default_avatar\x18j \x01(\x05\x12\x11\n\ttieba_uid\x18x \x01(\t\x12\x12\n\nip_address\x18\x7f \x01(\t\x12\x33\n\x12virtual_image_info\x18\x88\x01 \x01(\x0b\x32\x16.User.VirtualImageInfo\x12&\n\x0buser_growth\x18\x89\x01 \x01(\x0b\x32\x10.User.UserGrowth\x1a\xab\x01\n\x08PrivSets\x12\x10\n\x08location\x18\x01 \x01(\x05\x12\x0c\n\x04like\x18\x02 \x01(\x05\x12\r\n\x05group\x18\x03 \x01(\x05\x12\x0c\n\x04post\x18\x04 \x01(\x05\x12\x0e\n\x06\x66riend\x18\x05 \x01(\x05\x12\x0c\n\x04live\x18\x06 \x01(\x05\x12\r\n\x05reply\x18\x07 \x01(\x05\x12\x19\n\x11\x62\x61zhu_show_inside\x18\x08 \x01(\x05\x12\x1a\n\x12\x62\x61zhu_show_outside\x18\t \x01(\x05\x1a\x35\n\rLikeForumInfo\x12\x12\n\nforum_name\x18\x01 \x01(\t\x12\x10\n\x08\x66orum_id\x18\x02 \x01(\x04\x1a\x30\n\x0bUserVipInfo\x12\x10\n\x08v_status\x18\x01 \x01(\r\x12\x0f\n\x07v_level\x18\x05 \x01(\r\x1a\x19\n\tTshowInfo\x12\x0c\n\x04name\x18\x02 \x01(\t\x1a\x42\n\nNewGodInfo\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x10\n\x08\x66ield_id\x18\x02 \x01(\r\x12\x12\n\nfield_name\x18\x03 \x01(\t\x1a\x84\x01\n\x10VirtualImageInfo\x12\x1b\n\x13isset_virtual_image\x18\x01 \x01(\x05\x12\x38\n\x0epersonal_state\x18\t \x01(\x0b\x32 .User.VirtualImageInfo.StateInfo\x1a\x19\n\tStateInfo\x12\x0c\n\x04text\x18\x02 \x01(\t\x1a\x1e\n\nUserGrowth\x12\x10\n\x08level_id\x18\x01 \x01(\rb\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'User_pb2', globals()) @@ -21,19 +21,21 @@ DESCRIPTOR._options = None _USER._serialized_start=15 - _USER._serialized_end=1168 - _USER_PRIVSETS._serialized_start=662 - _USER_PRIVSETS._serialized_end=833 - _USER_LIKEFORUMINFO._serialized_start=835 - _USER_LIKEFORUMINFO._serialized_end=888 - _USER_USERVIPINFO._serialized_start=890 - _USER_USERVIPINFO._serialized_end=938 - _USER_TSHOWINFO._serialized_start=940 - _USER_TSHOWINFO._serialized_end=965 - _USER_NEWGODINFO._serialized_start=967 - _USER_NEWGODINFO._serialized_end=1033 - _USER_VIRTUALIMAGEINFO._serialized_start=1036 - _USER_VIRTUALIMAGEINFO._serialized_end=1168 - _USER_VIRTUALIMAGEINFO_STATEINFO._serialized_start=1143 - _USER_VIRTUALIMAGEINFO_STATEINFO._serialized_end=1168 + _USER._serialized_end=1240 + _USER_PRIVSETS._serialized_start=702 + _USER_PRIVSETS._serialized_end=873 + _USER_LIKEFORUMINFO._serialized_start=875 + _USER_LIKEFORUMINFO._serialized_end=928 + _USER_USERVIPINFO._serialized_start=930 + _USER_USERVIPINFO._serialized_end=978 + _USER_TSHOWINFO._serialized_start=980 + _USER_TSHOWINFO._serialized_end=1005 + _USER_NEWGODINFO._serialized_start=1007 + _USER_NEWGODINFO._serialized_end=1073 + _USER_VIRTUALIMAGEINFO._serialized_start=1076 + _USER_VIRTUALIMAGEINFO._serialized_end=1208 + _USER_VIRTUALIMAGEINFO_STATEINFO._serialized_start=1183 + _USER_VIRTUALIMAGEINFO_STATEINFO._serialized_end=1208 + _USER_USERGROWTH._serialized_start=1210 + _USER_USERGROWTH._serialized_end=1240 # @@protoc_insertion_point(module_scope) diff --git a/aiotieba/typedef.py b/aiotieba/typedef.py index 13cfaca0..5705fe80 100644 --- a/aiotieba/typedef.py +++ b/aiotieba/typedef.py @@ -149,6 +149,7 @@ class UserInfo(object): post_num (int): 发帖数 fan_num (int): 粉丝数 follow_num (int): 关注数 + glevel (int): 贴吧成长等级 sign (str): 个性签名 ip (str): ip归属地 vimage (VirtualImage): 虚拟形象信息 @@ -175,6 +176,7 @@ class UserInfo(object): '_post_num', '_fan_num', '_follow_num', + '_glevel', '_sign', '_vimage', '_ip', @@ -200,6 +202,7 @@ def __init__(self, _id: Union[str, int, None] = None, _raw_data: Optional[_TypeM self._post_num = _raw_data.post_num self._fan_num = _raw_data.fans_num self._follow_num = _raw_data.concern_num + self._glevel = _raw_data.user_growth.level_id self._sign = _raw_data.intro self._ip = _raw_data.ip_address self._vimage = VirtualImage( @@ -225,6 +228,7 @@ def __init__(self, _id: Union[str, int, None] = None, _raw_data: Optional[_TypeM self._post_num = 0 self._fan_num = 0 self._follow_num = 0 + self._glevel = 0 self._sign = '' self._vimage = VirtualImage() self._ip = '' @@ -468,6 +472,18 @@ def follow_num(self) -> int: def follow_num(self, new_follow_num: int) -> None: self._follow_num = new_follow_num + @property + def glevel(self) -> int: + """ + 贴吧成长等级 + """ + + return self._glevel + + @glevel.setter + def glevel(self, new_glevel: int) -> None: + self._glevel = new_glevel + @property def sign(self) -> str: """ @@ -1794,13 +1810,16 @@ class Thread(_Container): pid (int): 首楼回复pid user (UserInfo): 发布者的用户信息 author_id (int): 发布者的user_id + vimage (VirtualImage): 虚拟形象信息 + type (int): 帖子类型 tab_id (int): 分区编号 is_good (bool): 是否精品帖 is_top (bool): 是否置顶帖 is_share (bool): 是否分享帖 is_hide (bool): 是否被屏蔽 is_livepost (bool): 是否为置顶话题 + is_help (bool): 是否为求助帖 vote_info (VoteInfo): 投票信息 share_origin (ShareThread): 转发来的原帖内容 @@ -1816,7 +1835,9 @@ class Thread(_Container): __slots__ = [ '_contents', '_title', + '_vimage', '_tab_id', + '_type', '_is_good', '_is_top', '_is_share', @@ -1846,7 +1867,9 @@ def __init__(self, _raw_data: Optional[_TypeMessage] = None) -> None: self._pid = _raw_data.first_post_id self._user = UserInfo(_raw_data=_raw_data.author) if _raw_data.author.id else None self._author_id = _raw_data.author_id + self._vimage = VirtualImage(bool(_raw_data.custom_figure.background_value), _raw_data.custom_state.content) + self._type = _raw_data.thread_type self._tab_id = _raw_data.tab_id self._is_good = bool(_raw_data.is_good) self._is_top = bool(_raw_data.is_top) @@ -1868,6 +1891,9 @@ def __init__(self, _raw_data: Optional[_TypeMessage] = None) -> None: self._contents = None self._title = '' + self._vimage = VirtualImage() + + self._type = 0 self._tab_id = 0 self._is_good = False self._is_top = False @@ -1931,6 +1957,22 @@ def title(self) -> str: return self._title + @property + def vimage(self) -> VirtualImage: + """ + 虚拟形象信息 + """ + + return self._vimage + + @property + def type(self) -> int: + """ + 帖子类型 + """ + + return self._type + @property def tab_id(self) -> int: """ @@ -1979,6 +2021,14 @@ def is_livepost(self) -> bool: return self._is_livepost + @property + def is_help(self) -> bool: + """ + 是否为求助帖 + """ + + return self._type == 71 + @property def vote_info(self) -> VoteInfo: """ @@ -2118,18 +2168,13 @@ def objs(self) -> List[Thread]: if not isinstance(self._objs, list): if self._objs is not None: - threads = [Thread(_proto) for _proto in self._objs] + self._objs = [Thread(_proto) for _proto in self._objs] users = {user.user_id: user for _proto in self._users if (user := UserInfo(_raw_data=_proto)).user_id} self._users = None - for thread, _proto in zip(threads, self._objs): + for thread in self._objs: thread._fname = self.forum.fname thread._user = users[thread.author_id] - thread._user.vimage = VirtualImage( - bool(_proto.custom_figure.background_value), _proto.custom_state.content - ) - - self._objs = threads else: self._objs = [] @@ -2202,6 +2247,7 @@ class Post(_Container): pid (int): 回复id user (UserInfo): 发布者的用户信息 author_id (int): 发布者的user_id + vimage (VirtualImage): 虚拟形象信息 floor (int): 楼层数 reply_num (int): 楼中楼数 @@ -2215,6 +2261,7 @@ class Post(_Container): '_contents', '_sign', '_comments', + '_vimage', '_floor', '_reply_num', '_agree', @@ -2236,6 +2283,7 @@ def __init__(self, _raw_data: Optional[_TypeMessage] = None) -> None: self._pid = _raw_data.id self._user = UserInfo(_raw_data=_raw_data.author) if _raw_data.author.id else None self._author_id = _raw_data.author_id + self._vimage = VirtualImage(bool(_raw_data.custom_figure.background_value), _raw_data.custom_state.content) self._floor = _raw_data.floor self._reply_num = _raw_data.sub_post_number @@ -2248,6 +2296,8 @@ def __init__(self, _raw_data: Optional[_TypeMessage] = None) -> None: self._sign = None self._comments = None + self._vimage = VirtualImage() + self._floor = 0 self._reply_num = 0 self._agree = 0 @@ -2323,6 +2373,14 @@ def comments(self) -> List["Comment"]: return self._comments + @property + def vimage(self) -> VirtualImage: + """ + 虚拟形象信息 + """ + + return self._vimage + @property def floor(self) -> int: """ @@ -2430,19 +2488,16 @@ def objs(self) -> List[Post]: if not isinstance(self._objs, list): if self._objs is not None: - posts = [Post(_proto) for _proto in self._objs] + self._objs = [Post(_proto) for _proto in self._objs] users = {user.user_id: user for _proto in self._users if (user := UserInfo(_raw_data=_proto)).user_id} self._users = None - for post, _proto in zip(posts, self._objs): + for post in self._objs: post._fid = self.forum.fid post._fname = self.forum.fname post._tid = self.thread.tid post._user = users.get(post.author_id, None) - post._user.vimage = VirtualImage( - bool(_proto.custom_figure.background_value), _proto.custom_state.content - ) post._is_thread_author = self.thread.author_id == post.author_id for comment in post.comments: @@ -2451,8 +2506,6 @@ def objs(self) -> List[Post]: comment._tid = post.tid comment._user = users.get(comment.author_id, None) - self._objs = posts - else: self._objs = [] diff --git a/docs/index.md b/docs/index.md index 871fae34..0e509e01 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@

- GitHub Workflow Status + GitHub Workflow Status PyPI - Version diff --git a/tests/test_all.py b/tests/test_all.py index 4c623ed1..aee7aa6d 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -61,7 +61,7 @@ async def test_BasicUserInfo(client: tb.Client): @pytest.mark.asyncio async def test_Posts_and_Fragments(client: tb.Client): - posts = await client.get_posts(7763274602, only_thread_author=True, with_comments=True) + posts = await client.get_posts(7763274602, with_comments=True) # Test Post post = posts[6] @@ -147,6 +147,9 @@ async def test_Posts_and_Fragments(client: tb.Client): assert frag.text != "" assert isinstance(frag.url, str) + # Test VirtualImage + assert posts[10].vimage.enabled is True + def check_ShareThread(thread: tb.ShareThread): # Test FragText