(token, post_id)
| 282 | print(f"❌ 请求错误: {e}") |
| 283 | |
| 284 | def comment_post(token, post_id): |
| 285 | for _ in range(2): # 评论2次 |
| 286 | comment_content = get_random_one_word() # 使用随机一言作为评论内容 |
| 287 | url = "https://breoplus.breo.cn/breo-app/communityBaseInfo/comment" |
| 288 | headers = breo_task_headers(token) |
| 289 | data = { |
| 290 | "anonymoused": 0, |
| 291 | "commentText": comment_content, |
| 292 | "postId": post_id |
| 293 | } |
| 294 | try: |
| 295 | response = requests.post(url, headers=headers, data=json.dumps(data)) |
| 296 | if response.status_code == 200: |
| 297 | result = response.json() |
| 298 | if result.get("success", False): |
| 299 | print("✅ 评论成功!") |
| 300 | reward = result.get("result") or {} |
| 301 | root = reward.get("rootOutVO") or {} |
| 302 | print(f"评论内容: {root.get('commentText', comment_content)}") |
| 303 | print(f"获得点数: {reward.get('point', 0)}") |
| 304 | print(f"成长值: {reward.get('grow', 0)}") |
| 305 | else: |
| 306 | print(f"❌ 评论失败,错误信息:{result.get('message', '未知错误')}") |
| 307 | else: |
| 308 | print(f"❌ 请求失败,状态码:{response.status_code}") |
| 309 | except Exception as e: |
| 310 | print(f"❌ 请求错误: {e}") |
| 311 | time.sleep(1) # 避免频繁请求 |
| 312 | |
| 313 | def browse_mall(token): |
| 314 | url = "https://breoplus.breo.cn/breo-app/user/po-task-info/mall" |
no test coverage detected