Skip to content

Commit

Permalink
fix(download): optimize performance by checking binary content
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityPacer committed Dec 14, 2024
1 parent 782829c commit 11fedb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helper/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def download_torrent(self, url: str,
if not req.content:
return None, None, "", [], "未下载到种子数据"
# 解析内容格式
if req.text and str(req.text).startswith("magnet:"):
if req.content.startswith(b"magnet:"):
# 磁力链接
return None, req.text, "", [], f"获取到磁力链接"
elif req.text and "下载种子文件" in req.text:
if "下载种子文件".encode("utf-8") in req.content:
# 首次下载提示页面
skip_flag = False
try:
Expand Down

0 comments on commit 11fedb1

Please sign in to comment.