Files
hometown/scripts/README.md
2026-03-07 23:35:08 +08:00

27 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 720 云资源提取脚本
本目录为 Python 脚本,用于从 720yun 页面或保存的 HTML 中提取并下载全景图资源。**请在项目根目录下执行**,脚本会自动读写根目录下的 `text.md``image/``panorama/``config.json` 等。
## 脚本说明
| 脚本 | 用途 |
|------|------|
| **fetch_720yun.py** | 根据 720yun 页面 URL 抓取 HTML解析其中的全景图 URL 并下载到 `panorama/panorama.jpg`,同时更新根目录 `config.json`。适用于页面内直接包含图片链接的情况。 |
| **parse_720yun_doc.py** | 从项目根目录的 `text.md`720yun 页面另存为的文档)解析 `window.data` / `window.json`,得到六面图、缩略图等 URL可选 `--fetch` 请求场景 JSON`--download` 将六面图 + 缩略图下载到根目录 `image/`。 |
## 使用示例
```bash
# 在项目根目录 720yun-offline/ 下执行
# 方式一:按 URL 抓取(若页面由 JS 动态加载可能无结果)
python3 scripts/fetch_720yun.py "https://www.720yun.com/vr/xxxxx"
# 方式二:先浏览器打开 720 链接,整页另存为 text.md 放到项目根目录,再解析并下载六面图
python3 scripts/parse_720yun_doc.py # 仅解析,输出 parsed_720yun_resources.json
python3 scripts/parse_720yun_doc.py --fetch # 解析并请求场景 JSON
python3 scripts/parse_720yun_doc.py --download # 解析并将六面图、缩略图下载到 image/
```
下载到 `image/` 的文件可直接被前端使用(`config.json` 中已配置 `image/mobile_*.jpg`)。