mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-07-28 07:20:25 +08:00
fix: 将平台业务ID统一改为String并自动建表
- 抖音、B站、快手、微博的帖子/视频/评论ID从BigInteger改为String, 避免PostgreSQL下字符串写入BIGINT报错及未来ID溢出风险 - B站dynamic_id改为String,修复API返回id_str被强转int导致的精度丢失 - 知乎提取器对content_id/question_id显式str()转换 - main.py启动数据库保存模式时自动建表,无需手动--init_db - 同步更新相关老化测试
This commit is contained in:
4
main.py
4
main.py
@@ -106,6 +106,10 @@ async def main() -> None:
|
||||
print(f"Database {args.init_db} initialized successfully.")
|
||||
return
|
||||
|
||||
# 数据库保存模式下自动建表,避免首次运行时出现 no such table 错误
|
||||
if config.SAVE_DATA_OPTION in ("sqlite", "mysql", "db", "postgres"):
|
||||
await db.init_db(config.SAVE_DATA_OPTION)
|
||||
|
||||
crawler = CrawlerFactory.create_crawler(platform=config.PLATFORM)
|
||||
await crawler.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user