def offlineList(loginObj): dir = DirYunPan('/', loginObj.serverAddr) result = dir.offlineList(); task_list = {} if 'offline_task_list' in result: task_list = result['offline_task_list'] for i in task_list: print ("%s\t%s\t%s" % (i['status'], i['task_id'], i['url']))
def offlineDownload(loginObj, url): dir = DirYunPan('/', loginObj.serverAddr) result = dir.offlineDownload("http://todeer.sinaapp.com/include/lib/js/common_tpl.js"); print (result['task_id'])
import hashlib import json import re import os import importlib importlib.reload(sys) # sys.setdefaultencoding("utf-8") import utilsYunPan from loginYunPan import LoginYunPan from dirYunPan import DirYunPan from downloadYunPan import DownloadYunPan from downloadYunPan import DownloadManager if __name__ == '__main__': login = LoginYunPan() userinfo = login.run('用户名', '密码') pathYunPan = '~/test/' dir = DirYunPan(pathYunPan, login.serverAddr) # 需要下载的云盘路径 tree = dir.downloadDirTree('/', True) DownloadManager.pushQueue(tree) # 设置线程数 DownloadManager.start(dir, 10) # 离线下载 #result = dir.offlineDownload("http://todeer.sinaapp.com/include/lib/js/common_tpl.js"); # 获取离线下载列表 #result = dir.offlineList();