Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
download
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
download
Commits
7e8af164
Commit
7e8af164
authored
Dec 11, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
59b9124f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
dowload.py
dowload.py
+16
-16
No files found.
dowload.py
View file @
7e8af164
...
...
@@ -75,22 +75,6 @@ class DownFile:
time
.
sleep
(
10
)
count_sleep
=
0
if
len
(
item
[
'voice_file'
])
>
0
:
local_file
=
self
.
save_path
+
item
[
'voice_file'
]
string_end
=
item
[
'voice_file'
]
.
find
(
'/'
)
local_dir
=
item
[
'voice_file'
][
0
:
string_end
]
else
:
string_end
=
str
.
find
(
"?"
)
file_url
=
str
[
0
:
string_end
]
time_array
=
time
.
strptime
(
item
[
'call_time'
],
'
%
Y-
%
m-
%
d'
)
local_dir
=
time
.
strftime
(
'
%
Y-
%
m-
%
d'
,
time_array
)
local_file
=
self
.
save_path
+
local_dir
+
re
.
findall
(
r".com\D.*"
,
file_url
)[
0
][
5
:]
if
self
.
check_file
(
local_file
):
old_num
=
old_num
+
1
continue
try
:
count_sleep
=
count_sleep
+
1
# 增加暂停计数
url
=
self
.
ali_yun_sdk
(
item
[
'call_time'
],
item
[
'call_id'
])
...
...
@@ -113,6 +97,22 @@ class DownFile:
if
url
==
''
:
continue
if
len
(
item
[
'voice_file'
])
>
0
:
local_file
=
self
.
save_path
+
item
[
'voice_file'
]
string_end
=
item
[
'voice_file'
]
.
find
(
'/'
)
local_dir
=
item
[
'voice_file'
][
0
:
string_end
]
else
:
string_end
=
url
.
find
(
"?"
)
file_url
=
str
[
0
:
string_end
]
time_array
=
time
.
strptime
(
item
[
'call_time'
],
'
%
Y-
%
m-
%
d'
)
local_dir
=
time
.
strftime
(
'
%
Y-
%
m-
%
d'
,
time_array
)
local_file
=
self
.
save_path
+
local_dir
+
re
.
findall
(
r".com\D.*"
,
file_url
)[
0
][
5
:]
if
self
.
check_file
(
local_file
):
old_num
=
old_num
+
1
continue
self
.
check_dir
(
self
.
save_path
+
local_dir
)
result
=
request
.
urlretrieve
(
url
,
local_file
)
download_num
=
download_num
+
1
...
...
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