|
|
|
@ -6,6 +6,7 @@ from loguru import logger |
|
|
|
import os |
|
|
|
from datetime import datetime |
|
|
|
import config |
|
|
|
import json |
|
|
|
|
|
|
|
from utils import CookieUtils |
|
|
|
|
|
|
|
@ -80,8 +81,9 @@ if __name__ == '__main__': |
|
|
|
os.mkdir('./data') |
|
|
|
for k in config.KEYWORDS: |
|
|
|
all_result = process_search_results(cookies, k, config.MAX_PAGE) |
|
|
|
json_string = json.dumps(all_result, indent=4, ensure_ascii=False) |
|
|
|
with open(f"./data/{k}_{datetime.now().strftime('%Y_%m_%d_%H%M%S')}.json", 'w', encoding='utf-8') as file: |
|
|
|
for item in all_result: |
|
|
|
file.write(f"{item}\n") |
|
|
|
file.write(f"{json_string}\n") |
|
|
|
logger.success(f"{k} 查询结果已保存") |
|
|
|
|