Skip to content

Commit 76e5868

Browse files
committed
新增pconline断点下载功能
1 parent dd7a402 commit 76e5868

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

fuck/pconline.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,17 @@ def get_link(url, token):
5454

5555
def download(file_path):
5656
"""
57-
执行下载
57+
执行下载,支持断点续传
5858
"""
59-
response = s.get(file_path, headers=header)
59+
import os
6060
file_name = file_path.split('/')[-1]
61+
save_file_path = '../static/download/'+file_name
6162
print file_name
62-
with open('../static/download/'+file_name, 'wb') as f:
63-
f.write(response.content)
63+
print save_file_path
64+
# 伪装浏览器,组装下载命令
65+
cmd = "wget --user-agent=\"%s\" -c -O %s %s" % (header['User-Agent'], save_file_path, file_path)
66+
print cmd
67+
os.system(cmd)
6468

6569

6670
def fuck():

0 commit comments

Comments
 (0)