Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd_arg/arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PlatformEnum(str, Enum):
WEIBO = "wb"
TIEBA = "tieba"
ZHIHU = "zhihu"
XIAOHEIHE = "xhh"


class LoginTypeEnum(str, Enum):
Expand Down Expand Up @@ -106,7 +107,7 @@ def _coerce_enum(
return enum_cls(value)
except ValueError:
typer.secho(
f"⚠️ Config value '{value}' is not within the supported range of {enum_cls.__name__}, falling back to default value '{default.value}'.",
f"\u26a0\ufe0f Config value '{value}' is not within the supported range of {enum_cls.__name__}, falling back to default value '{default.value}'.",
fg=typer.colors.YELLOW,
)
return default
Expand Down Expand Up @@ -162,7 +163,7 @@ def main(
PlatformEnum,
typer.Option(
"--platform",
help="Media platform selection (xhs=XiaoHongShu | dy=Douyin | ks=Kuaishou | bili=Bilibili | wb=Weibo | tieba=Baidu Tieba | zhihu=Zhihu)",
help="Media platform selection (xhs=XiaoHongShu | dy=Douyin | ks=Kuaishou | bili=Bilibili | wb=Weibo | tieba=Baidu Tieba | zhihu=Zhihu | xhh=XiaoHeiHe)",
rich_help_panel="Basic Configuration",
),
] = _coerce_enum(PlatformEnum, config.PLATFORM, PlatformEnum.XHS),
Expand Down
3 changes: 2 additions & 1 deletion config/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# 使用本代码即表示您同意遵守上述原则和LICENSE中的所有条款。

# Basic configuration
PLATFORM = "xhs" # Platform, xhs | dy | ks | bili | wb | tieba | zhihu
PLATFORM = "xhs" # Platform, xhs | dy | ks | bili | wb | tieba | zhihu | xhh

# 是否使用海外版小红书 (rednote.com)
# 开启后 API 走 webapi.rednote.com,cookie 域使用 .rednote.com
Expand Down Expand Up @@ -143,3 +143,4 @@
from .weibo_config import *
from .tieba_config import *
from .zhihu_config import *
from .xhh_config import *
16 changes: 16 additions & 0 deletions config/xhh_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2025 relakkes@gmail.com
#
# This file is part of MediaCrawler project.
# Licensed under NON-COMMERCIAL LEARNING LICENSE 1.1
#

# Xiaoheihe (小黑盒) platform configuration

# 指定帖子 link_id 列表(detail 模式)
XHH_SPECIFIED_ID_LIST = [
"179403000",
]

# 创作者 user_id 列表(creator 模式)
XHH_CREATOR_ID_LIST: list = ["93126766"]
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from media_platform.kuaishou import KuaishouCrawler
from media_platform.tieba import TieBaCrawler
from media_platform.weibo import WeiboCrawler
from media_platform.xhh import XiaoHeiHeCrawler
from media_platform.xhs import XiaoHongShuCrawler
from media_platform.zhihu import ZhihuCrawler
from tools.async_file_writer import AsyncFileWriter
Expand All @@ -56,6 +57,7 @@ class CrawlerFactory:
"wb": WeiboCrawler,
"tieba": TieBaCrawler,
"zhihu": ZhihuCrawler,
"xhh": XiaoHeiHeCrawler,
}

@staticmethod
Expand Down
10 changes: 10 additions & 0 deletions media_platform/xhh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2025 relakkes@gmail.com
#
# This file is part of MediaCrawler project.
# Licensed under NON-COMMERCIAL LEARNING LICENSE 1.1
#

from .core import XiaoHeiHeCrawler

__all__ = ["XiaoHeiHeCrawler"]
Loading