temp

连接:http://pan.baidu.com/s/1gfhF3xD 密码:kmhgsql

 http://dsideal.oss-cn-qingdao-internal.aliyuncs.com/BeiJing.zipide

SELECT * FROM t_resource_info WHERE scheme_id_int in
(4269,15842,15871,15873,15909,34199,106089,4270,15864,15876,15893,15903,34018,34022,34025,4267,15857,15868,15882,15899,15905,34269,34270,39308,4278,15877,15887,15889,15910,33768,33941,33942,105852)
AND release_status in (1,3);url

import os
import sys
from Util.MySQLHelper import *


# 下载指定的Url地址下的文件
def DownloadFile(url, Dir, FileName):
    command = sys.path[
                  0] + "\\aria2-1.19.0\\aria2c.exe" + " -c -s 2 --check-certificate=false -d " + Dir + " -o " + FileName + " " + url
    os.system(command)


# oss-cn-qingdao-internal.aliyuncs.com

if __name__ == "__main__":
    targetPath = "d:\\BeiJing"
    db = MySQLHelper()
    sql = "SELECT FILE_ID,RESOURCE_FORMAT,THUMB_ID FROM t_resource_info WHERE scheme_id_int in (4269,15842,15871,15873,15909,34199,106089,4270,15864,15876,15893,15903,34018,34022,34025,4267,15857,15868,15882,15899,15905,34269,34270,39308,4278,15877,15887,15889,15910,33768,33941,33942,105852) AND release_status in (1,3)"
    dt = db.query(sql)
    count = 0
    for row in dt:
        count = count + 1
        print("正在下载第" + str(count) + "个,共30510个!")
        # 一、Material
        FileId = row['FILE_ID']
        ResourceFormat = row['RESOURCE_FORMAT']
        ThumbId = row['THUMB_ID']

        url = "http://dsideal-yy.oss-cn-qingdao-internal.aliyuncs.com/down/Material/" + FileId[0:2] + '/' + FileId + '.' + ResourceFormat

        SavePath = targetPath + "\\Material\\" + FileId[0:2]
        if not os.path.exists(SavePath):
            os.mkdir(SavePath)

        DownloadFile(url, SavePath, FileId + '.' + ResourceFormat)
        # Thumbs
        url = "http://dsideal-yy.oss-cn-qingdao-internal.aliyuncs.com/down/Thumbs/" + ThumbId[
                                                                                        0:2] + '/' + ThumbId + '.thumb'
        ThumbsSavePath = targetPath + "\\Thumbs\\" + ThumbId[0:2]
        if not os.path.exists(ThumbsSavePath):
            os.mkdir(ThumbsSavePath)

        DownloadFile(url, ThumbsSavePath, ThumbId + '.thumb')
    print('恭喜,全部下载成功完成!')
相关文章
相关标签/搜索