|
@@ -14,6 +14,8 @@ import time
|
|
|
import requests
|
|
|
import urllib3
|
|
|
|
|
|
+proxies = {"http": None, "https": None}
|
|
|
+
|
|
|
|
|
|
class Common:
|
|
|
# 统一获取当前时间 <class 'datetime.datetime'> 2022-04-14 20:13:51.244472
|
|
@@ -98,7 +100,7 @@ class Common:
|
|
|
|
|
|
# 下载视频
|
|
|
urllib3.disable_warnings()
|
|
|
- response = requests.get(video_url, stream=True, verify=False)
|
|
|
+ response = requests.get(video_url, stream=True, proxies=proxies, verify=False)
|
|
|
try:
|
|
|
with open(video_dir + video_name, "wb") as f:
|
|
|
for chunk in response.iter_content(chunk_size=10240):
|
|
@@ -116,7 +118,7 @@ class Common:
|
|
|
|
|
|
# 下载封面
|
|
|
urllib3.disable_warnings()
|
|
|
- response = requests.get(cover_url, verify=False)
|
|
|
+ response = requests.get(cover_url, proxies=proxies, verify=False)
|
|
|
try:
|
|
|
with open(video_dir + cover_name, "wb") as f:
|
|
|
f.write(response.content)
|