|
用Python处理
我举例一个json
json里又title是目录,然后也会按照这个值来创建文件夹保存文件
type是folder的时候,里面还有二级目录,然后还可能会有三级四级的目录
思路我是有一点点的,遍历json,然后判断type,不是folder就直接保存文件名,下载链接,是folder就继续往下遍历,得到全部文件名和链接之后就下载它们
- [ { "type": "folder", "title": "目录1", "children": [ { "type": "audio", "hash": "hash/0", "title": "01.xxxx.wav", "workTitle": "标题", "mediaStreamUrl": "在线链接", "mediaDownloadUrl": "下载链接" }, { "type": "audio", "hash": "hash/1", "title": "02.xxxx.wav", "workTitle": "标题", "mediaStreamUrl": "在线链接", "mediaDownloadUrl": "下载链接" } ] }, { "type": "folder", "title": "目录2", "children": [ { "type": "audio", "hash": "hash/2", "title": "01.xxxx.wav", "workTitle": "标题", "mediaStreamUrl": "在线链接", "mediaDownloadUrl": "下载链接" }, { "type": "audio", "hash": "hash/3", "title": "02.xxxx.wav", "workTitle": "标题", "mediaStreamUrl": "在线链接", "mediaDownloadUrl": "下载链接" } ] }, { "type": "text", "hash": "hash/4", "title": "Readme.txt", "workTitle": "标题", "mediaStreamUrl": "在线链接", "mediaDownloadUrl": "下载链接" } ]
复制代码 |
|