27 lines
707 B
Python
27 lines
707 B
Python
#!/usr/bin/env python3
|
|
"""从小红书自己的 source 数据生成离线包;不读取或写入其他项目。"""
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
MINI = ROOT.parent
|
|
# Only this project's exporter is allowed.
|
|
CANDIDATES = (
|
|
ROOT / "scripts" / "export-xhs-offline.mjs",
|
|
)
|
|
|
|
|
|
def main() -> int:
|
|
script = next((p for p in CANDIDATES if p.is_file()), None)
|
|
if not script:
|
|
print(f"missing export-xhs-offline.mjs under {CANDIDATES}", file=sys.stderr)
|
|
return 1
|
|
return subprocess.call(["node", str(script)], cwd=str(MINI))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|