提交 5fcdf451 作者: XveLingKun

东方财富网指标中英对比调整 完成

上级 71156c0a
"""
"""
......@@ -158,13 +158,17 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
for one_info in soup_zcfzb.find_all('tr')[2:]:
if 'value.' not in one_info.text:
continue
# todo:24-4-12 添加判断标签是否是隐藏标签,是则跳过,找下一个标签
# todo:24-4-12 添加判断标签是否是隐藏标签,是则跳过,找下一个标签
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
if 'display:none' in info_tag.get('style'):
continue
else:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
......@@ -198,7 +202,24 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
for one_info in soup_lrb.find_all('tr')[2:]:
if 'value.' not in one_info.text:
continue
info_name = one_info.find('span').text
# todo:24-4-12 添加判断标签是否是隐藏标签,是则跳过,找下一个标签
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
pass
else:
continue
# info_name = one_info.find('span').text
if '审计意见' in info_name:
continue
info_name_en = re.findall('value\.(.*?)\)}}', one_info.text)[0]
......@@ -229,9 +250,13 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
if 'display:none' in info_tag.get('style'):
continue
else:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
......@@ -299,7 +324,7 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
soup_name = BeautifulSoup(res_name.content, 'html.parser')
# 第一个表
try:
script_zcfzb = soup_name.find('script', {'id': 'cccccccccc_qy'})
script_zcfzb = soup_name.find('script', {'id': 'zcfzb_qy'})
if script_zcfzb:
soup_zcfzb = BeautifulSoup(script_zcfzb.text.strip(), 'lxml')
else:
......@@ -371,9 +396,13 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
if 'display:none' in info_tag.get('style'):
continue
else:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
......@@ -397,7 +426,7 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
"name": info_name,
'enName': info_name_en,
"value": info_data,
"unit": '元'
"unit": "元"
}
list_zcfzb.append(dic_info_zcfzb)
......@@ -411,9 +440,13 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
if 'display:none' in info_tag.get('style'):
continue
else:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
......@@ -437,7 +470,7 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
"name": info_name,
'enName': info_name_en,
"value": info_data,
'unit': '元'
"unit": "元"
}
list_lrb.append(dic_info_lrb)
......@@ -451,9 +484,13 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
info_tag_list = one_info.find_all('span')
info_name = ''
for info_tag in info_tag_list:
if 'display:none' in info_tag.get('style'):
continue
else:
try:
if 'display:none' in info_tag.get('style'):
continue
else:
info_name = info_tag.text
break
except:
info_name = info_tag.text
break
if info_name:
......@@ -477,7 +514,7 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
"name": info_name,
'enName': info_name_en,
"value": info_data,
'unit':'元'
"unit": "元"
}
list_xjllb.append(dic_info_xjllb)
......@@ -519,7 +556,7 @@ def getReportTime():
# list_date = ['2023-09-30','2023-06-30','2023-03-31']
list_month = ['-12-31', '-09-30', '-06-30', '-03-31']
for year in range(year, 2018, -1):
for year in range(2018, year+1):
for month in list_month[::-1]:
date = str(year) + month
#todo:判断拼接的报告期是否大于当前日期,如果大于当前日期,怎说明还没到这个时间,跳过
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论