BlankerL / DXY-COVID-19-Crawler

2019新型冠状病毒疫情实时爬虫及API | COVID-19/2019-nCoV Realtime Infection Crawler and API
https://lab.isaaclin.cn/nCoV/
MIT License
1.99k stars 400 forks source link

修复爬虫错误 #37

Closed hack-fang closed 4 years ago

hack-fang commented 4 years ago

丁香园更新了overall_information的结构,导致解析json出错,原因是获取的字符串少了 ]}

crawler.py47行以下更改即可

# old
#overall_information = re.search(r'\{("id".*?)\}', str(soup.find('script', attrs={'id': 'getStatisticsService'})))
# new
overall_information = re.search(r'\{("id".*?)\]\}', str(soup.find('script', attrs={'id':'getStatisticsService'})))
BlankerL commented 4 years ago

万分感谢,已经修改并重启爬虫。可以直接提交pull request,我会merge进来的~