mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-06-06 01:47:26 +08:00
fix(store): 修复存储实现的AsyncFileWriter导入
重构小红书存储实现,将store_comments方法改为处理单个评论的store_comment 为多个平台添加AsyncFileWriter工具类导入
This commit is contained in:
@@ -32,14 +32,13 @@ class XhsCsvStoreImplement(AbstractStore):
|
||||
"""
|
||||
await self.writer.write_to_csv(item_type="contents", item=content_item)
|
||||
|
||||
async def store_comments(self, comments: List[Dict]):
|
||||
async def store_comment(self, comment_item: Dict):
|
||||
"""
|
||||
store comments data to csv file
|
||||
:param comments:
|
||||
store comment data to csv file
|
||||
:param comment_item:
|
||||
:return:
|
||||
"""
|
||||
for comment in comments:
|
||||
await self.writer.write_to_csv(item_type="comments", item=comment)
|
||||
await self.writer.write_to_csv(item_type="comments", item=comment_item)
|
||||
|
||||
|
||||
async def store_creator(self, creator_item: Dict):
|
||||
@@ -62,14 +61,13 @@ class XhsJsonStoreImplement(AbstractStore):
|
||||
"""
|
||||
await self.writer.write_single_item_to_json(item_type="contents", item=content_item)
|
||||
|
||||
async def store_comments(self, comments: List[Dict]):
|
||||
async def store_comment(self, comment_item: Dict):
|
||||
"""
|
||||
store comments data to json file
|
||||
:param comments:
|
||||
store comment data to json file
|
||||
:param comment_item:
|
||||
:return:
|
||||
"""
|
||||
for comment in comments:
|
||||
await self.writer.write_single_item_to_json(item_type="comments", item=comment)
|
||||
await self.writer.write_single_item_to_json(item_type="comments", item=comment_item)
|
||||
|
||||
async def store_creator(self, creator_item: Dict):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user