-
Notifications
You must be signed in to change notification settings - Fork 0
/
下载上市公司公告.py
36 lines (29 loc) · 1 KB
/
下载上市公司公告.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import szreport
from szreport import *;
sz=szreport.SZ()
# first post
file_url = "http://disc.static.szse.cn/download"
res = sz.get_resp_jNode(1, 30)
for i in res['data']:
sz.pdf_list.append(file_url+i['attachPath'])
sz.name_list.append(sz.format_title(i['title']))
# 计算页数
total = res['announceCount']
#page_nums = total / 30 + 1
page_nums = 500
page_index = 500
print('正在检索...')
while page_index <= page_nums:
res = sz.get_resp_jNode(page_index, 30)
# print(res['data'])
for i in res['data']:
print(i['secCode'][0]+"--"+i['secName'][0]+"--"+i['title']+"--"+i['publishTime'])
sz.pdf_list.append(file_url+i['attachPath'])
sz.name_list.append(sz.format_title(i['title']))
page_index += 1
print('已查找到所有下载链接,共:', len(sz.pdf_list), '条')
# 下载
save_dir = 'D:\\szTest\\'
sz.download_and_extract(sz.pdf_list, sz.name_list,save_dir)
print(sz.announcement_count())
print(sz.get_stock_name("002569"))