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
f6938618
Commit
f6938618
authored
Mar 02, 2020
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注释
parent
1d9f25f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
download.py
download.py
+29
-5
No files found.
download.py
View file @
f6938618
...
...
@@ -16,7 +16,8 @@ class DownFile:
self
.
page_string
=
page_string
self
.
call_date_string
=
call_date_string
def
ali_yun_sdk
(
self
,
call_time
,
call_id
):
@staticmethod
def
ali_yun_sdk
(
call_time
,
call_id
):
"""
获取下载链接
:param call_time:
...
...
@@ -47,7 +48,8 @@ class DownFile:
down_url
=
''
return
down_url
def
get_data
(
self
,
url
):
@staticmethod
def
get_data
(
url
):
"""
获取通话记录
:param url:
...
...
@@ -153,13 +155,25 @@ class DownFile:
self
.
log
(
"download_num"
,
num
)
self
.
log
(
"old_num"
,
old_num
)
def
check_file
(
self
,
file
):
@staticmethod
def
check_file
(
file
):
"""
检查文件是否存在
:param file:
:return:
"""
result
=
False
if
os
.
path
.
exists
(
file
):
result
=
True
return
result
def
check_dir
(
self
,
dir
):
@staticmethod
def
check_dir
(
dir
):
"""
检查目录是否存在
:param dir:
:return:
"""
if
os
.
path
.
exists
(
dir
):
result
=
True
else
:
...
...
@@ -181,7 +195,13 @@ class DownFile:
self
.
log
(
'download_successful'
,
self
.
page_string
+
"="
+
str
(
page_no
))
def
log
(
self
,
title
,
content
):
@staticmethod
def
log
(
title
,
content
):
"""
日志记录
:param title:
:param content:
"""
time_str
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
time
.
localtime
())
insert_string
=
"[{time}] {a} {b} {c}"
.
format
(
time
=
time_str
,
a
=
title
,
b
=
content
,
c
=
'
\n
'
)
date
=
time
.
strftime
(
"
%
Y-
%
m-
%
d"
,
time
.
localtime
())
...
...
@@ -191,6 +211,10 @@ class DownFile:
f
.
close
()
def
start_thread
(
self
,
day_num
=
7
):
"""
开启多线程下载录音
:param day_num: int 天数
"""
today
=
datetime
.
date
.
today
()
page_no
=
1
while
day_num
>
0
:
...
...
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