Compare commits

...

9 Commits

Author SHA1 Message Date
qaiu b5f7d9694b 更新 README.md 2026-08-16 21:20:04 +08:00
qaiu f75d9f687b 更新 README.md 2026-08-16 21:18:37 +08:00
qaiu 703bfa3061 Merge pull request #213 from qaiu/claude/fangcloud-share-validity-check-9fzoi6
fix(parser): FangCloud share validity check reads the wrong JSON field
2026-08-13 16:05:23 +08:00
Claude 6c709fde65 fix(parser): fix FangCloud share validity check and h5 share link regex
Root cause confirmed against a live share link: FcTool never actually
checked share validity against the info API — it read a top-level
"is_valid" field that the endpoint doesn't return. The real validity
flags (process.is_closed / process.is_expired) live under "process",
so an invalid share fell through to HTML scraping and surfaced a
confusing "未匹配到文件id(typed_id)" error instead of a clear
"分享已失效" message. parse() now checks share_links/info first and
fails fast with a clear message when the share is closed/expired.

Also widen PanDomainTemplate's FC regex to accept the mobile H5
landing page path (/h5/share/{key}), which previously didn't match
at all.

Updated verify_fangcloud_share.py to reflect the confirmed API
response shape instead of the earlier incorrect guess.
2026-08-13 07:46:29 +00:00
Claude 449fd741ac Add diagnostic script for FangCloud share validity check
FcTool.java's share validity check hits a share_links/info endpoint on
v2.fangcloud.cn that doesn't appear in the project's own captured
traffic (pan-fc.http) or public docs, and its regex in
PanDomainTemplate doesn't match the /h5/share/ path used by mobile
links. This script reproduces both requests against a live share URL
to confirm the root cause before fixing the parser.
2026-08-13 07:29:42 +00:00
qaiu c18b8d80e1 更新 README.md 2026-08-07 09:36:35 +08:00
qaiu 06ba0aff52 Merge pull request #211 from qaiu/copilot/update-readme-to-latest-version
docs: update download URL to latest release v0.4.2
2026-08-05 21:42:39 +08:00
copilot-swe-agent[bot] 74e401d99c docs: fix download URL and zip filename for v0.4.2 linux-amd64
Co-authored-by: qaiu <29825328+qaiu@users.noreply.github.com>
2026-08-05 13:28:37 +00:00
copilot-swe-agent[bot] 4995bca901 docs: update download URL to latest release v0.4.2
Co-authored-by: qaiu <29825328+qaiu@users.noreply.github.com>
2026-08-05 13:18:11 +00:00
4 changed files with 230 additions and 29 deletions
+39 -26
View File
@@ -28,25 +28,31 @@ QQ交流群:1017480890
[公益解析,lz0站](https://lz0.qaiu.top)
[专业版](https://189.qaiu.top)
## 快速开始
命令行下载分享文件:
```shell
curl -LOJ "https://lz.qaiu.top/parser?url=https://share.feijipan.com/s/Tk1F2kGQ&pwd=1234"
```
或者使用wget:
```shell
wget -O bilibili.mp4 "https://lz.qaiu.top/parser?url=https://share.feijipan.com/s/Tk1F2kGQ&pwd=1234"
```
或者使用浏览器[直接访问](https://nfd-parser.github.io/nfd-preview/preview.html?src=https%3A%2F%2Flz.qaiu.top%2Fparser%3Furl%3Dhttps%3A%2F%2Fwww.ilanzou.com%2Fs%2FCDx6xKbT&name=bilibili.mp4&ext=mp4):
```
### 调用演示站下载:
https://lz.qaiu.top/parser?url=https://www.ilanzou.com/s/CDx6xKbT&pwd=1234
### 调用演示站预览:
https://nfd-parser.github.io/nfd-preview/preview.html?src=https%3A%2F%2Flz.qaiu.top%2Fparser%3Furl%3Dhttps%3A%2F%2Fwww.ilanzou.com%2Fs%2FCDx6xKbT&name=bilibili.mp4&ext=mp4
以带提取码的分享链接为例(提取码 `1234`),链接中含 `#``&`,作为 `url` 参数传入前必须做 URL 编码:
`https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=70017ece572737b12b30709b7f029308eJD0&isShare=1`
**命令行下载**
```shell
# curl
curl -LOJ "https://lz.qaiu.top/parser?url=https%3A%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside%26data%3D70017ece572737b12b30709b7f029308eJD0%26isShare%3D1&pwd=1234"
# wget
wget -O v01 "https://lz.qaiu.top/parser?url=https%3A%2F%2Fwww.ecpan.cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside%26data%3D70017ece572737b12b30709b7f029308eJD0%26isShare%3D1&pwd=1234"
```
**短链方式**key 取分享链接的 `data` 参数,提取码用 `@` 拼接)
| 用途 | 地址 |
| --- | --- |
| 下载 | `https://lz.qaiu.top/ec/70017ece572737b12b30709b7f029308eJD0@1234` |
| 在线预览 | [点击访问](https://nfd-parser.github.io/nfd-preview/preview.html?src=https%3A%2F%2Flz.qaiu.top%2Fec%2F70017ece572737b12b30709b7f029308eJD0%401234&name=v01&ext=mp4) |
> 无提取码时去掉 `&pwd=1234` / `@1234` 即可;预览页 `src` 需编码(`@` → `%40`),用短链可避免二次编码。
**解析器模块文档:** [parser/README.md](parser/README.md)
**JavaScript解析器文档:** [JavaScript解析器开发指南](parser/doc/JAVASCRIPT_PARSER_GUIDE.md) | [自定义解析器扩展指南](parser/doc/CUSTOM_PARSER_GUIDE.md) | [快速开始](parser/doc/CUSTOM_PARSER_QUICKSTART.md)
@@ -133,6 +139,7 @@ GET /json/parser?url={分享链接}&pwd={密码}
```
GET /json/{网盘标识}/{分享key}@{密码}
```
注意: 移动云云空间的 `分享key` 取分享链接中的 `data` 参数值
#### 3. 文件夹解析(v0.1.8fixed3+
@@ -230,11 +237,6 @@ auths:
如果只是临时调用一次,不想改动服务端配置,也可以用上面提到的 `auth` 参数临时传递(`authType` 可选 `password`/`accesstoken`/`authorization`),无需重启服务,仅本次请求生效。
### 特殊说明
- 移动云云空间的 `分享key` 取分享链接中的 `data` 参数值
- 移动云云空间、小飞机网盘的加密分享可忽略密码参数
### 示例
```bash
@@ -455,8 +457,8 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtow
> 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径
```shell
cd ~
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v3.0.2/netdisk-fast-download-bin.zip
unzip netdisk-fast-download-bin.zip
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.4.2/netdisk-fast-download-linux-amd64.zip
unzip netdisk-fast-download.zip
cd netdisk-fast-download
bash service-install.sh
```
@@ -544,11 +546,22 @@ Core模块集成Vert.x实现类似spring的注解式路由API
</picture>
</a>
## **免责声明**
- 用户在使用本项目时,应自行承担风险,并确保其行为符合当地法律法规。开发者不对用户因使用本项目而导致的任何后果负责。
## 支持该项目
开源不易,用爱发电,本项目长期维护如果觉得有帮助, 可以请作者喝杯咖啡, 感谢支持
## **声明**
- 本项目**仅供个人学习与技术交流使用**,请勿用于商业用途或大规模滥用。
- 所用接口均来自各网盘**官方开放平台**、官方公开接口及**已知开源项目**,仅解析用户主动提供的分享链接,**不涉及破解或绕过版权保护**。
- 本项目**相当于自动化程序代替用户发起请求**,**不会提升或绕过任何会员权限**,也**不会突破网盘的限速策略**;我们**鼓励用户开通官方 VIP/SVIP**以获得更好的下载与加速体验。
- 使用者应遵守各网盘服务商的**用户协议与使用条款**,以及所在地区的**法律法规**,违反所产生的后果自行承担。
- **高频调用可能触发网盘风控**,导致**账号限流、封禁**或**来源 IP 被屏蔽**,请合理控制请求频率,避免高并发与批量请求。
- 网盘接口调整、风控策略变更等因素可能导致功能失效,本项目**不对可用性与稳定性作任何担保**。
- 开发者**不对**使用本项目产生的**任何直接或间接损失**(账号封禁、数据丢失、法律纠纷等)**承担责任**。
- 开发者保留**随时修改本免责声明**的权利,恕不另行通知。
- **下载、部署或使用本项目,即视为您已阅读并接受上述全部条款。**
## 赞助该项目
开源不易,用爱发电,本项目长期维护如果觉得有帮助, 可以请开发者[喝杯咖啡](https://blog.qaiu.top/archives/da-shang-zhuan-yong), 感谢支持。
本项目的服务器由林枫云提供赞助<br>
</a>
@@ -121,9 +121,9 @@ public enum PanDomainTemplate {
"https://lecloud.lenovo.com/share/{shareKey}",
LeTool.class),
// https://v2.fangcloud.com/s/
// https://v2.fangcloud.com/s/ https://v2.fangcloud.cn/h5/share/ (移动端H5落地页)
FC("亿方云",
compile("https://v2\\.fangcloud\\.(com|cn)/(s|share|sharing)/(?<KEY>.+)"),
compile("https://v2\\.fangcloud\\.(com|cn)/(?:h5/)?(s|share|sharing)/(?<KEY>.+)"),
"https://v2.fangcloud.com/s/{shareKey}",
"https://www.fangcloud.com/",
FcTool.class),
@@ -22,6 +22,7 @@ public class FcTool extends PanBase {
public static final String SHARE_URL_PREFIX = "https://v2.fangcloud.com/sharing/";
public static final String SHARE_URL_PREFIX2 = "https://v2.fangcloud.cn/sharing/";
private static final String SHARE_INFO_URL = "https://v2.fangcloud.cn/apps/share_links/info/";
private static final String DOWN_REQUEST_URL = "https://v2.fangcloud.cn/apps/files/download?file_id={fid}" +
"&scenario=share&unique_name={uname}";
@@ -38,6 +39,25 @@ public class FcTool extends PanBase {
final String dataKey = shareLinkInfo.getShareKey();
final String pwd = shareLinkInfo.getSharePassword();
WebClientSession sClient = WebClientSession.create(client);
// 先查询分享有效性, 避免分享已失效/已过期时仍去解析HTML, 报出令人困惑的技术错误
sClient.getAbs(SHARE_INFO_URL + dataKey).send().onSuccess(infoRes -> {
JsonObject infoJson = asJson(infoRes);
if (promise.future().isComplete()) {
return;
}
JsonObject process = infoJson.getJsonObject("process");
boolean isClosed = process != null && Boolean.TRUE.equals(process.getBoolean("is_closed"));
boolean isExpired = process != null && Boolean.TRUE.equals(process.getBoolean("is_expired"));
if (process == null || isClosed || isExpired) {
fail("分享已失效或不存在");
return;
}
doParse(dataKey, pwd, sClient);
}).onFailure(handleFail(SHARE_INFO_URL + dataKey));
return promise.future();
}
private void doParse(String dataKey, String pwd, WebClientSession sClient) {
// 第一次请求 自动重定向
sClient.getAbs(SHARE_URL_PREFIX + dataKey).send().onSuccess(res -> {
@@ -67,7 +87,6 @@ public class FcTool extends PanBase {
}
getDownURL(dataKey, promise, res, sClient);
}).onFailure(handleFail(SHARE_URL_PREFIX + dataKey));
return promise.future();
}
private void getDownURL(String dataKey, Promise<String> promise, HttpResponse<Buffer> res,
+169
View File
@@ -0,0 +1,169 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
亿方云 (FangCloud) 分享链接有效性验证脚本
用法: 直接 `python3 verify_fangcloud_share.py` 运行, 分享链接已写死在 SHARE_URL
里 (不走命令行传参), 要换链接就直接改这个常量。
根因(已用真实分享链接验证确认)
--------------------------------
GET https://v2.fangcloud.cn/apps/share_links/info/{uname}
返回的是 200 + JSON, 结构形如:
{
"process": {
"is_closed": false,
"is_expired": false,
"item": {"type": "file", "id": 45006535173, "name": "..."},
...
}
}
FcTool.java 原来的实现判断有效性时读的是响应体**顶层**的 "is_valid" 字段
(`json.getBoolean("is_valid")`), 但这个字段根本不存在于该接口的实际响应里
(有效性信息实际上是 process.is_closed / process.is_expired, 且没有任何
名叫 "is_valid" 的字段) —— 所以旧的判断逻辑其实从未真正读取过这个接口的
有效性判断, 而是走的另一套 HTML 抓取 typed_id 的流程, 分享失效时会得到一个
"未匹配到文件id(typed_id)" 这种令人困惑的技术报错, 而不是清晰的"分享已失效"
修复方案(已同步到 FcTool.java): 解析前先请求一次
https://v2.fangcloud.cn/apps/share_links/info/{uname}, 用
process.is_closed / process.is_expired 判断分享是否有效, 无效则直接返回
"分享已失效或不存在", 有效再继续走原来的 HTML + files/download 流程。
本脚本用于本地复现/回归验证这条判断逻辑, 并顺带跑一遍完整的取直链流程。
"""
import re
import sys
import requests
# 直接写死分享链接, 不通过命令行参数传入
SHARE_URL = "https://v2.fangcloud.cn/h5/share/ded6dc6b9c3672b40b769804bf"
# 如果分享有密码, 在这里填上, 没有就留空字符串
SHARE_PASSWORD = ""
HEADERS = {
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
),
"Accept": "application/json, text/html;q=0.9, */*;q=0.8",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
}
# 修复后的正则, 额外兼容 /h5/share/ 移动端落地页路径 (对齐 PanDomainTemplate.FC)
FC_REGEX = re.compile(r"https://v2\.fangcloud\.(com|cn)/(?:h5/)?(s|share|sharing)/(?P<KEY>.+)")
SHARE_INFO_URL = "https://v2.fangcloud.cn/apps/share_links/info/{key}"
SHARE_URL_PREFIX = "https://v2.fangcloud.com/sharing/{key}"
DOWN_REQUEST_URL = "https://v2.fangcloud.cn/apps/files/download"
TYPED_ID_RE = re.compile(r'id="typed_id"\s+value="file_(\d+)"')
def extract_share_key(url: str) -> str:
m = FC_REGEX.search(url)
if not m:
raise ValueError(f"无法从链接中提取 shareKey (正则不匹配): {url}")
return m.group("KEY")
def check_is_valid(share_key: str, session: requests.Session) -> bool:
print("=" * 70)
print("Step 1. 请求 share_links/info 判断分享有效性 (对齐 FcTool.java 修复后的逻辑)")
print("=" * 70)
url = SHARE_INFO_URL.format(key=share_key)
r = session.get(url, timeout=15)
print(f"GET {url}")
print(f"状态码: {r.status_code}")
try:
data = r.json()
except Exception:
print("响应不是合法JSON => 判定分享已失效或不存在\n")
return False
process = data.get("process")
if not process:
print("响应中没有 process 字段 => 判定分享已失效或不存在\n")
return False
is_closed = bool(process.get("is_closed"))
is_expired = bool(process.get("is_expired"))
item = process.get("item")
print(f"is_closed = {is_closed}, is_expired = {is_expired}, item = {item}")
if is_closed or is_expired:
print("=> 分享已失效或不存在\n")
return False
print("=> 分享有效\n")
return True
def get_download_url(share_key: str, pwd: str, session: requests.Session) -> str:
print("=" * 70)
print("Step 2. 走原有 HTML + files/download 流程取直链")
print("=" * 70)
r = session.get(SHARE_URL_PREFIX.format(key=share_key), timeout=15)
print(f"GET {SHARE_URL_PREFIX.format(key=share_key)} -> {r.status_code}, 最终URL: {r.url}")
html = r.text
if pwd:
# 加密分享: 提交密码换取跳转后的落地页 (此处仅示意, 具体见 FcTool.java)
m = re.search(r'name="requesttoken"\s+value="([a-zA-Z0-9_+=]+)"', html)
if not m:
raise RuntimeError("未匹配到加密分享的密码输入页面的 requesttoken")
token = m.group(1)
r2 = session.post(
"https://v2.fangcloud.cn/sharing/" + share_key,
data={"requesttoken": token, "password": pwd},
timeout=15,
)
html = r2.text
m = TYPED_ID_RE.search(html)
if not m:
raise RuntimeError("未匹配到文件id(typed_id), 分享可能是文件夹或页面结构有变化")
fid = m.group(1)
print(f"提取到 file_id = {fid}")
r3 = session.get(
DOWN_REQUEST_URL,
params={"file_id": fid, "scenario": "share", "unique_name": share_key},
timeout=15,
allow_redirects=False,
)
print(f"GET {DOWN_REQUEST_URL} -> {r3.status_code}")
if r3.status_code in (301, 302) and r3.headers.get("Location"):
return r3.headers["Location"]
data = r3.json()
if not data.get("success"):
raise RuntimeError(f"取直链失败: {data}")
return data["download_url"]
def main() -> None:
share_key = extract_share_key(SHARE_URL)
print(f"分享链接: {SHARE_URL}")
print(f"提取到的 shareKey: {share_key}\n")
session = requests.Session()
session.headers.update(HEADERS)
if not check_is_valid(share_key, session):
print("结论: 分享无效, 不再继续取直链。")
sys.exit(1)
try:
url = get_download_url(share_key, SHARE_PASSWORD, session)
print(f"\n>>> 直链: {url}")
except Exception as e:
print(f"\n取直链失败: {e}")
sys.exit(1)
if __name__ == "__main__":
main()