| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- # config.py
- class Config:
- # 当前绝对路径
- import os
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-
- IMAGE_DIR = r"D:\桌面\研究生\组会\rednote\data"
- CHROME_DRIVER_PATH = r"D:/下载/chromedriver-win64/chromedriver-win64/chromedriver.exe"
- USER_DATA_DIR = r"user-data-dir=" + os.path.join(BASE_DIR, "user_data")
- PAGE_LOAD_TIMEOUT = 40
- ELEMENT_WAIT_TIMEOUT = 40
-
- # 发布配置默认值
- _POST_CONFIG = {
- 'image_paths': [],
- 'title': "你能告诉我这是什么风格吗?",
- 'description': "每天输出一套穿搭\n",
- 'topic': ["每日穿搭", "今日分享"],
- 'upload_time': "2025-07-07 10:26"
- }
- @classmethod
- def set_post_config(cls, **kwargs):
- """
- 设置发布配置
- :param kwargs: 可以包含 title, description, topic, upload_time
- """
- for key, value in kwargs.items():
- if key in cls._POST_CONFIG:
- cls._POST_CONFIG[key] = value
- else:
- raise ValueError(f"Invalid config key: {key}")
- @classmethod
- def get_post_config(cls):
- """
- 获取当前的发布配置
- :return: 当前的发布配置字典
- """
- return cls._POST_CONFIG.copy() # 返回副本以防止直接修改
|