Extend the timout duration

This commit is contained in:
Evil0ctal 2022-11-09 19:06:31 -08:00 committed by GitHub
parent 17cc1efe15
commit a52c49db23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,7 +127,7 @@ class Scraper:
print('正在通过抖音分享链接获取原始链接...') print('正在通过抖音分享链接获取原始链接...')
try: try:
async with httpx.AsyncClient(proxies=self.proxies) as client: 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: if response.status_code == 302:
# 视频链接302重定向'Location'字段 # 视频链接302重定向'Location'字段
# https://www.iesdouyin.com/share/video/7148345687535570206/ # https://www.iesdouyin.com/share/video/7148345687535570206/
@ -160,7 +160,7 @@ class Scraper:
print('正在通过TikTok分享链接获取原始链接...') print('正在通过TikTok分享链接获取原始链接...')
try: try:
async with httpx.AsyncClient(proxies=self.proxies) as client: 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: if response.status_code == 301:
# 视频链接302重定向'Location'字段 # 视频链接302重定向'Location'字段
# https://www.tiktok.com/@tiktok/video/6950000000000000000 # https://www.tiktok.com/@tiktok/video/6950000000000000000