MCPcopy Create free account
hub / github.com/Jack-Cherish/python-spider / get_informations

Method get_informations

financical.py:78–105  ·  view source on GitHub ↗
(self, url)

Source from the content-addressed store, hash-verified

76 2017-08-31
77 """
78 def get_informations(self, url):
79 req = requests.get(url = url, headers = self.headers)
80 req.encoding = 'utf-8'
81 html = req.text
82 page_bf = BeautifulSoup(html, 'lxml')
83 #股票名称,股票代码
84 name = page_bf.find_all('span', class_ = 'name')[0].string
85 # code = page_bf.find_all('span', class_ = 'code')[0].string
86 # code = re.findall('\d+',code)[0]
87
88 #存储各个表名的列表
89 table_name_list = []
90 table_date_list = []
91 each_date_list = []
92 url_list = []
93 #表名和表时间
94 table_name = page_bf.find_all('div', class_ = 'titlebar3')
95 for each_table_name in table_name:
96 #表名
97 table_name_list.append(each_table_name.span.string)
98 #表时间
99 for each_table_date in each_table_name.div.find_all('select', id = re.compile('.+1$')):
100 url_list.append(re.findall('(\w+)1',each_table_date.get('id'))[0])
101 for each_date in each_table_date.find_all('option'):
102 each_date_list.append(each_date.string)
103 table_date_list.append(each_date_list)
104 each_date_list = []
105 return name,table_name_list,table_date_list,url_list
106
107 """
108 函数说明:财务报表入库

Callers 1

financical.pyFile · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected