From a5370e2e49f5d91629b58a3d6c28c4eca1d0176c Mon Sep 17 00:00:00 2001 From: d0zingcat Date: Wed, 6 Mar 2024 16:34:16 +0800 Subject: [PATCH] use requestutils instead Signed-off-by: d0zingcat --- plugins/brushflow/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/brushflow/__init__.py b/plugins/brushflow/__init__.py index 35ca9a3..c1453b9 100644 --- a/plugins/brushflow/__init__.py +++ b/plugins/brushflow/__init__.py @@ -1,5 +1,4 @@ import re -import requests import threading import time from datetime import datetime, timedelta @@ -19,6 +18,7 @@ from app.modules.qbittorrent import Qbittorrent from app.modules.transmission import Transmission from app.plugins import _PluginBase from app.schemas import Notification, NotificationType, TorrentInfo +from app.utils.http import RequestUtils from app.utils.string import StringUtils lock = threading.Lock() @@ -1663,10 +1663,10 @@ class BrushFlow(_PluginBase): tag = StringUtils.generate_random_str(10) content = torrent.enclosure if self._offline_mode: - torrent_resp = requests.get(content, - headers={'User-Agent': torrent.site_ua.strip(), 'cookie': torrent.site_cookie.strip()}) - if torrent_resp.ok: - content = torrent_resp.content + torrent_res = RequestUtils(cookies=torrent.site_cookie, + ua=torrent.site_ua).get_res(url=content) + if torrent_res.ok: + content = torrent_res.content else: logger.error('下载种子文件失败,继续提交种子链接进行下载') state = self.qb.add_torrent(content=content,