1234567891011121314151617181920212223242526272829 |
- import asyncio
- import time
- from core.models.video_item import VideoItem # 你的 Pydantic 模型路径
- from pprint import pprint
- async def main():
- fake_video_data = {
- "user_id": "uid456",
- "user_name": "测试用户",
- "out_video_id": "out789",
- "out_user_id": "out_user",
- "video_url": "http://example.com/video.mp4",
- "cover_url": "http://example.com/cover.jpg",
- "video_title": " 测试 视频 标题!!!",
- "publish_time_stamp": int(time.time()) - 86400, # 昨天
- "strategy": "recommend",
- "platform": "test_platform"
- }
- item = VideoItem(**fake_video_data)
- result = await item.produce_item()
- print("✅ 校验通过的最终结构:")
- pprint(result)
- if __name__ == "__main__":
- asyncio.run(main())
|