Closed AccountOfLom closed 3 years ago
可以提供一个ugoira的完整json吗?我试试这个URL是怎么访问的 download其实就是CDN请求,加了一个请求header。可能这个URL并不是直接访问的,要看看客户端请求的实际情况
api.ugoira_metadata("81604358") 响应结果如下:
{
"ugoira_metadata": {
"zip_urls": {
"medium": "https://i.pximg.net/img-zip-ugoira/img/2020/05/16/15/38/37/81604358_ugoira600x600.zip"
},
"frames": [
{
"file": "000000.jpg",
"delay": 60
},
{
"file": "000001.jpg",
"delay": 60
},
{
"file": "000002.jpg",
"delay": 60
},
{
"file": "000003.jpg",
"delay": 60
},
{
"file": "000004.jpg",
"delay": 30
},
{
"file": "000005.jpg",
"delay": 60
},
{
"file": "000006.jpg",
"delay": 60
},
{
"file": "000007.jpg",
"delay": 60
},
{
"file": "000008.jpg",
"delay": 60
},
{
"file": "000009.jpg",
"delay": 60
},
{
"file": "000010.jpg",
"delay": 60
},
{
"file": "000011.jpg",
"delay": 60
},
{
"file": "000012.jpg",
"delay": 30
},
{
"file": "000013.jpg",
"delay": 60
},
{
"file": "000014.jpg",
"delay": 60
},
{
"file": "000015.jpg",
"delay": 60
},
{
"file": "000016.jpg",
"delay": 60
},
{
"file": "000017.jpg",
"delay": 60
},
{
"file": "000018.jpg",
"delay": 60
},
{
"file": "000019.jpg",
"delay": 60
},
{
"file": "000020.jpg",
"delay": 30
},
{
"file": "000021.jpg",
"delay": 60
},
{
"file": "000022.jpg",
"delay": 60
},
{
"file": "000023.jpg",
"delay": 60
},
{
"file": "000024.jpg",
"delay": 60
},
{
"file": "000025.jpg",
"delay": 60
},
{
"file": "000026.jpg",
"delay": 60
},
{
"file": "000027.jpg",
"delay": 60
},
{
"file": "000028.jpg",
"delay": 30
},
{
"file": "000029.jpg",
"delay": 60
},
{
"file": "000030.jpg",
"delay": 60
},
{
"file": "000031.jpg",
"delay": 60
},
{
"file": "000032.jpg",
"delay": 60
},
{
"file": "000033.jpg",
"delay": 60
},
{
"file": "000034.jpg",
"delay": 60
},
{
"file": "000035.jpg",
"delay": 60
},
{
"file": "000036.jpg",
"delay": 30
},
{
"file": "000037.jpg",
"delay": 60
},
{
"file": "000038.jpg",
"delay": 60
},
{
"file": "000039.jpg",
"delay": 60
},
{
"file": "000040.jpg",
"delay": 60
},
{
"file": "000041.jpg",
"delay": 60
},
{
"file": "000042.jpg",
"delay": 60
}
]
}
}
试了下,应该就是这个URL。增加header后挂代理就可以下载: https://i.pximg.net/img-zip-ugoira/img/2020/05/16/15/38/37/81604358_ugoira600x600.zip
download的核心是增加Referer: https://app-api.pixiv.net/
,但从你描述看返回是false:
https://github.com/upbit/pixivpy/blob/7768c4b4455f00f6f78e5ab3d49c5e1408a0a8b5/pixivpy3/api.py#L146-L147
可能是因为文件名已经存在了。你可以用name参数改个名字,或者指定 replace=True
找到原因了,正你所说的,文件是下载成功的,只是我自己编码上的疏忽,使zip文件和图片保存的地址不一致,让我没一时间没有发现它。 非常感谢!!
api.ugoira_metadata
接口获取了作品的zip_urls
,但此zip_urls
在api.download
接口得到了false
的返回值,download
接口下载图片是正常的。 请问该如何处理,谢谢!