|
@@ -0,0 +1,43 @@
|
|
|
+#!/usr/bin/env python
|
|
|
+# -*- encoding: utf-8 -*-
|
|
|
+'''
|
|
|
+@Contact : liuyuqi.gov@msn.cn
|
|
|
+@Time : 2024/08/13 12:23:44
|
|
|
+@License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
|
|
|
+@Desc : Download QQ email attachments
|
|
|
+Use Chrome to get the download link, replace the cookie to download
|
|
|
+'''
|
|
|
+
|
|
|
+import re
|
|
|
+import requests
|
|
|
+from tqdm import tqdm
|
|
|
+import os,sys
|
|
|
+
|
|
|
+if len(sys.argv) != 3:
|
|
|
+ print("Usage: python script.py <url> <cookie>")
|
|
|
+ sys.exit(1)
|
|
|
+
|
|
|
+# url =r"""
|
|
|
+# cookie =r""
|
|
|
+url = sys.argv[1]
|
|
|
+cookie = sys.argv[2]
|
|
|
+
|
|
|
+headers = {
|
|
|
+ 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
|
|
|
+ "cookie": cookie
|
|
|
+}
|
|
|
+
|
|
|
+def run():
|
|
|
+ """ run """
|
|
|
+ response = requests.get(url, headers=headers, stream=True)
|
|
|
+ total_size = int(response.headers.get('content-length', 0))
|
|
|
+
|
|
|
+ with open("qq2.zip", "wb") as file:
|
|
|
+ with tqdm(total=total_size, unit='B', unit_scale=True, unit_divisor=1024) as bar:
|
|
|
+ for chunk in response.iter_content(chunk_size=1024):
|
|
|
+ if chunk:
|
|
|
+ file.write(chunk)
|
|
|
+ bar.update(len(chunk))
|
|
|
+
|
|
|
+if __name__=='__main__':
|
|
|
+ run()
|