MediaCrawler/model/m_baidu_tieba.py

61 lines
2.7 KiB
Python
Raw Normal View History

2024-08-06 17:01:21 +00:00
# -*- coding: utf-8 -*-
from typing import Optional
2024-08-08 06:19:32 +00:00
2024-08-06 17:01:21 +00:00
from pydantic import BaseModel, Field
class TiebaNote(BaseModel):
2024-08-06 18:34:56 +00:00
"""
百度贴吧帖子
"""
2024-08-06 17:01:21 +00:00
note_id: str = Field(..., description="帖子ID")
title: str = Field(..., description="帖子标题")
desc: str = Field(default="", description="帖子描述")
note_url: str = Field(..., description="帖子链接")
publish_time: str = Field(default="", description="发布时间")
user_link: str = Field(default="", description="用户主页链接")
user_nickname: str = Field(default="", description="用户昵称")
user_avatar: str = Field(default="", description="用户头像地址")
tieba_name: str = Field(..., description="贴吧名称")
tieba_link: str = Field(..., description="贴吧链接")
total_replay_num: int = Field(default=0, description="回复总数")
total_replay_page: int = Field(default=0, description="回复总页数")
ip_location: Optional[str] = Field(default="", description="IP地理位置")
2024-08-23 00:29:24 +00:00
source_keyword: str = Field(default="", description="来源关键词")
2024-08-06 18:34:56 +00:00
class TiebaComment(BaseModel):
"""
百度贴吧评论
"""
comment_id: str = Field(..., description="评论ID")
2024-08-06 20:13:15 +00:00
parent_comment_id: str = Field(default="", description="父评论ID")
2024-08-06 18:34:56 +00:00
content: str = Field(..., description="评论内容")
user_link: str = Field(default="", description="用户主页链接")
user_nickname: str = Field(default="", description="用户昵称")
user_avatar: str = Field(default="", description="用户头像地址")
publish_time: str = Field(default="", description="发布时间")
ip_location: Optional[str] = Field(default="", description="IP地理位置")
sub_comment_count: int = Field(default=0, description="子评论数")
note_id: str = Field(..., description="帖子ID")
note_url: str = Field(..., description="帖子链接")
2024-08-06 20:13:15 +00:00
tieba_id: str = Field(..., description="所属的贴吧ID")
2024-08-06 18:34:56 +00:00
tieba_name: str = Field(..., description="所属的贴吧名称")
2024-08-06 20:13:15 +00:00
tieba_link: str = Field(..., description="贴吧链接")
2024-08-06 18:34:56 +00:00
2024-08-24 01:12:03 +00:00
class TiebaCreator(BaseModel):
"""
百度贴吧创作者
"""
user_id: str = Field(..., description="用户ID")
user_name: str = Field(..., description="用户名")
nickname: str = Field(..., description="用户昵称")
gender: str = Field(default="", description="用户性别")
avatar: str = Field(..., description="用户头像地址")
ip_location: Optional[str] = Field(default="", description="IP地理位置")
follows: int = Field(default=0, description="关注数")
fans: int = Field(default=0, description="粉丝数")
registration_duration: str = Field(default="", description="注册时长")