Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ak.epidemic_baidu(indicator="历史") not working for two days #14

Closed
ericqianli opened this issue Feb 19, 2020 · 6 comments
Closed

ak.epidemic_baidu(indicator="历史") not working for two days #14

ericqianli opened this issue Feb 19, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@ericqianli
Copy link

epidemic_baidu_df = ak.epidemic_baidu(indicator="历史")
print(epidemic_baidu_df)

Fetching historic data from epidemic_baidu@akshare...
Traceback (most recent call last):
File "", line 8, in
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/akshare/event/sos.py", line 278, in epidemic_baidu
json_data = json.loads(r.text[r.text.find("V.conf = ") + 9: r.text.find("V.bsData") - 1])
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Successfully installed akshare-0.4.1

@albertandking
Copy link
Collaborator

Yeah, AkShare verision at 0.4.2 have fixed this issue.

@albertandking albertandking added the bug Something isn't working label Feb 19, 2020
@ericqianli
Copy link
Author

0.4.2 fixed the issue but the data is out of date:

╰─ python3 < crawler_history.py
Fetching historic data from epidemic_baidu@akshare...
1.26 1.27 1.28 1.29 1.30 1.31 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15
确诊 2761 4535 5997 7736 9720 11821 14411 17238 20471 24363 28060 31211 34598 37251 40235 42708 44730 59882 63932 66576 68584
疑似 5794 6973 9239 12167 15238 17988 19544 21558 23214 23260 24702 26359 27657 28942 23589 21675 16067 13435 10109 8969 8228
治愈 51 60 103 126 171 243 328 475 632 892 1153 1542 2050 2651 3283 3998 4742 5915 6728 8101 9425
死亡 80 106 132 170 213 259 304 361 425 491 564 637 723 812 909 1017 1114 1368 1381 1524 1666
新增确诊 769 1771 1459 1737 1982 2102 2590 2829 3235 3887 3694 3151 3399 2653 3073 2484 2022 15153 5093 2644 2009
新增疑似 3806 2077 3248 4148 4812 5019 4562 5173 5072 3971 5328 4833 4214 3916 4008 3536 3342 2807 2450 2277 1918

Also now the DataGrid is transposed.

@albertandking
Copy link
Collaborator

0.4.2 fixed the issue but the data is out of date:

╰─ python3 < crawler_history.py
Fetching historic data from epidemic_baidu@akshare...
1.26 1.27 1.28 1.29 1.30 1.31 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15
确诊 2761 4535 5997 7736 9720 11821 14411 17238 20471 24363 28060 31211 34598 37251 40235 42708 44730 59882 63932 66576 68584
疑似 5794 6973 9239 12167 15238 17988 19544 21558 23214 23260 24702 26359 27657 28942 23589 21675 16067 13435 10109 8969 8228
治愈 51 60 103 126 171 243 328 475 632 892 1153 1542 2050 2651 3283 3998 4742 5915 6728 8101 9425
死亡 80 106 132 170 213 259 304 361 425 491 564 637 723 812 909 1017 1114 1368 1381 1524 1666
新增确诊 769 1771 1459 1737 1982 2102 2590 2829 3235 3887 3694 3151 3399 2653 3073 2484 2022 15153 5093 2644 2009
新增疑似 3806 2077 3248 4148 4812 5019 4562 5173 5072 3971 5328 4833 4214 3916 4008 3536 3342 2807 2450 2277 1918

Also now the DataGrid is transposed.

yes, baidu data source had changed the interface and the history data had stopped at 2-15

@ericqianli
Copy link
Author

Thanks for the update. Is there another historic data API that I can use?

@albertandking
Copy link
Collaborator

Thanks for the update. Is there another historic data API that I can use?

i have checked some data-source and find that the detail data have stopped at 20200215

@albertandking
Copy link
Collaborator

Thanks for the update. Is there another historic data API that I can use?

at akshare version 0.4.4 'epidemic_history' can get the historical data update now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants