Update other_than.py

This commit is contained in:
HibiKier 2021-12-24 10:20:57 +08:00 committed by GitHub
parent 71f860a500
commit 58957cdf44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ async def get_other_data(place: str) -> Optional[str]:
return None
find_data = re.compile(r"varallData=(.*?);</script>")
sum_ = re.findall(find_data, html)[0]
try:
sum_ = json.loads(sum_)
other_country = sum_["yiqing_v2"]["dataList"][29]["child"]
for country in other_country:
@ -67,4 +68,6 @@ async def get_other_data(place: str) -> Optional[str]:
f"死亡:{intcomma(city['siwang'])}\n"
"——————————————"
)
except Exception as e:
logger.error(f"疫情查询发生错误 {type(e)}{e}")
return None