Skip to content

Commit 680339d

Browse files
committed
Fix TikTok Web fetch_user_post()
1 parent b438d69 commit 680339d

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

crawlers/tiktok/web/models.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,47 @@ class UserProfile(BaseRequestModel):
4949
uniqueId: str
5050

5151

52-
class UserPost(BaseRequestModel):
52+
class UserPost(BaseModel):
53+
WebIdLastTime: str = "1714385892"
54+
aid: str = "1988"
55+
app_language: str = "zh-Hans"
56+
app_name: str = "tiktok_web"
57+
browser_language: str = "zh-CN"
58+
browser_name: str = "Mozilla"
59+
browser_online: str = "true"
60+
browser_platform: str = "Win32"
61+
browser_version: str = "5.0%20%28Windows%29"
62+
channel: str = "tiktok_web"
63+
cookie_enabled: str = "true"
64+
count: int = 20
5365
coverFormat: int = 2
54-
count: int = 35
5566
cursor: int = 0
67+
data_collection_enabled: str = "true"
68+
device_id: str = "7380187414842836523"
69+
device_platform: str = "web_pc"
70+
focus_state: str = "true"
71+
from_page: str = "user"
72+
history_len: str = "3"
73+
is_fullscreen: str = "false"
74+
is_page_visible: str = "true"
75+
language: str = "zh-Hans"
76+
locate_item_id: str = "7480776736817319186"
77+
needPinnedItemIds: str = "true"
78+
odinId: str = "7404669909585003563"
79+
os: str = "windows"
80+
# 0:默认排序,1:热门排序,2:最旧排序
81+
post_item_list_request_type: int = 0
82+
priority_region: str = "US"
83+
referer: str = ""
84+
region: str = "US"
85+
screen_height: str = "827"
86+
screen_width: str = "1323"
5687
secUid: str
88+
tz_name: str = "America%2FLos_Angeles"
89+
user_is_login: str = "true"
90+
webcast_language: str = "zh-Hans"
91+
msToken: str = "SXtP7K0MMFlQmzpuWfZoxAlAaKqt-2p8oAbOHFBw-k3TA2g4jE_FXrFKf3i38lR-xNh_bV1_qfTPRnj4PXbkBfrVD2iAazeUkASIASHT0pu-Bx2_POx7O3nBBHZe2SI7CPsanerdclxHht1hcoUTlg%3D%3D"
92+
_signature: str = "_02B4Z6wo000017oyWOQAAIDD9xNhTSnfaDu6MFxAAIlj23"
5793

5894

5995
class UserLike(BaseRequestModel):

crawlers/tiktok/web/web_crawler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ async def get_all_unique_id(self, urls: list):
344344

345345
async def main(self):
346346
# 获取单个作品数据
347-
item_id = "7369296852669205791"
348-
response = await self.fetch_one_video(item_id)
349-
print(response)
347+
# item_id = "7369296852669205791"
348+
# response = await self.fetch_one_video(item_id)
349+
# print(response)
350350

351351
# 获取用户的个人信息
352352
# secUid = "MS4wLjABAAAAfDPs6wbpBcMMb85xkvDGdyyyVAUS2YoVCT9P6WQ1bpuwEuPhL9eFtTmGvxw1lT2C"

0 commit comments

Comments
 (0)