liuyuqi-dellpc 7 months ago
parent
commit
a9da7f45e8
5 changed files with 116 additions and 1 deletions
  1. 1 0
      .gitignore
  2. 16 1
      README.md
  3. 43 0
      download_qq_tar.py
  4. 38 0
      download_qq_tar.spec
  5. 18 0
      pyproject.toml

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+download_qq_tar

+ 16 - 1
README.md

@@ -1,3 +1,18 @@
 # download_qq_tar
 
-服务器端,下载qq邮箱附件
+Server-side, download QQ email attachments
+
+## Usage
+
+1. Use Chrome DevTools (F12) to obtain the download link and cookie.
+2. Download `download_qq_tar` and execute:
+```
+wget https://xx.com/download_qq_tar.tar.gz
+download_qq_tar https://gzc-dfsdown.mail.ftn.qq.com/xx pac_uid=0_FJizADikrJ5DM; _qimei
+```
+There are two parameters: URL and cookie. The cookie needs to be separated by semicolons, e.g., `pac_uid=0_FJizADikrJ5DM; _qimei`. You can copy it directly from Chrome.
+
+## License
+
+## Reference
+

+ 43 - 0
download_qq_tar.py

@@ -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()

+ 38 - 0
download_qq_tar.spec

@@ -0,0 +1,38 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+
+a = Analysis(
+    ['download_qq_tar.py'],
+    pathex=[],
+    binaries=[],
+    datas=[],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    noarchive=False,
+    optimize=0,
+)
+pyz = PYZ(a.pure)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.datas,
+    [],
+    name='download_qq_tar',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=True,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+)

+ 18 - 0
pyproject.toml

@@ -0,0 +1,18 @@
+[tool.poetry]
+name = "download_qq_tar"
+version = "0.1.0"
+description = "downlaod qq tar file"
+authors = ["fish <zz1036@qq.com>"]
+readme = "README.md"
+
+[tool.poetry.dependencies]
+python = ">=3.12,<3.14"
+requests = "^2.32.3"
+
+
+[tool.poetry.group.dev.dependencies]
+pyinstaller = "^6.10.0"
+
+[build-system]
+requires = ["poetry-core"]
+build-backend = "poetry.core.masonry.api"