From a52c49db2303fa1b343ab81efaec24c15f61b544 Mon Sep 17 00:00:00 2001 From: Evil0ctal Date: Wed, 9 Nov 2022 19:06:31 -0800 Subject: [PATCH] =?UTF-8?q?=E2=8F=B3=20Extend=20the=20timout=20duration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scraper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scraper.py b/scraper.py index 9c62640..8d76f04 100644 --- a/scraper.py +++ b/scraper.py @@ -127,7 +127,7 @@ class Scraper: print('正在通过抖音分享链接获取原始链接...') try: async with httpx.AsyncClient(proxies=self.proxies) as client: - response = await client.get(url, headers=self.headers, follow_redirects=False) + response = await client.get(url, headers=self.headers, follow_redirects=False, timeout=10) if response.status_code == 302: # 视频链接302重定向'Location'字段 # https://www.iesdouyin.com/share/video/7148345687535570206/ @@ -160,7 +160,7 @@ class Scraper: print('正在通过TikTok分享链接获取原始链接...') try: async with httpx.AsyncClient(proxies=self.proxies) as client: - response = await client.get(url, headers=self.headers, follow_redirects=False) + response = await client.get(url, headers=self.headers, follow_redirects=False, timeout=10) if response.status_code == 301: # 视频链接302重定向'Location'字段 # https://www.tiktok.com/@tiktok/video/6950000000000000000