Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
doudian-py
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiquan
doudian-py
Commits
ebe6d9a1
Commit
ebe6d9a1
authored
Jul 09, 2025
by
baiquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加上传视频代理验证
parent
334804f0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
service/upload_video.py
+12
-2
No files found.
service/upload_video.py
View file @
ebe6d9a1
...
@@ -17,6 +17,7 @@ from loguru import logger
...
@@ -17,6 +17,7 @@ from loguru import logger
from
tqdm
import
tqdm
from
tqdm
import
tqdm
from
service.doudian_request
import
doudian_request
from
service.doudian_request
import
doudian_request
from
utils.common
import
check_proxy
HEADERS
=
{
HEADERS
=
{
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
...
@@ -165,7 +166,12 @@ class Upload:
...
@@ -165,7 +166,12 @@ class Upload:
self
.
access_key_id
=
None
self
.
access_key_id
=
None
self
.
file_size
=
None
self
.
file_size
=
None
self
.
file_name
=
None
self
.
file_name
=
None
self
.
proxies
=
task
.
get
(
"proxies"
)
addr
=
task
.
get
(
"proxies"
)[
"addr"
]
port
=
task
.
get
(
"proxies"
)[
"port"
]
username
=
task
.
get
(
"proxies"
)[
"username"
]
password
=
task
.
get
(
"proxies"
)[
"password"
]
proxy_url
=
f
"socks5h://{username}:{password}@{addr}:{port}"
self
.
proxies
=
check_proxy
(
proxy_url
)
self
.
cookies
=
task
.
get
(
'cookie'
)
self
.
cookies
=
task
.
get
(
'cookie'
)
self
.
headers
=
task
.
get
(
'headers'
)
self
.
headers
=
task
.
get
(
'headers'
)
...
@@ -661,6 +667,7 @@ def upload_video_with_multithreading(task):
...
@@ -661,6 +667,7 @@ def upload_video_with_multithreading(task):
def
prepare_video_file
(
task
):
def
prepare_video_file
(
task
):
"""准备视频文件"""
"""准备视频文件"""
if
not
task
.
get
(
"file_path"
):
if
not
os
.
path
.
exists
(
VIDEO_PATH
):
if
not
os
.
path
.
exists
(
VIDEO_PATH
):
os
.
makedirs
(
VIDEO_PATH
)
os
.
makedirs
(
VIDEO_PATH
)
...
@@ -675,7 +682,10 @@ def prepare_video_file(task):
...
@@ -675,7 +682,10 @@ def prepare_video_file(task):
if
is_video_corrupted
(
file_path
):
if
is_video_corrupted
(
file_path
):
logger
.
error
(
"视频文件已损坏,正在重新下载"
)
logger
.
error
(
"视频文件已损坏,正在重新下载"
)
download_video
(
task
[
'video_url'
],
file_path
,
headers
=
task
[
'headers'
])
download_video
(
task
[
'video_url'
],
file_path
,
headers
=
task
[
'headers'
])
else
:
file_path
=
task
.
get
(
"file_path"
)
if
is_video_corrupted
(
file_path
):
raise
Exception
(
"视频文件已损坏"
)
video_duration
=
get_video_duration
(
file_path
)
video_duration
=
get_video_duration
(
file_path
)
if
video_duration
>
60
:
if
video_duration
>
60
:
logger
.
error
(
"视频时长大于60秒,上传失败"
)
logger
.
error
(
"视频时长大于60秒,上传失败"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment