In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to use Python crawler Scrapy to crawl Chinese seismic data, for this problem, this article details the corresponding analysis and solution, hoping to help more friends who want to solve this problem find a simpler and easier way.
preface
I always feel that there are a lot of earthquake news recently, so I want to climb a wave of earthquake-related data to see.
development tools
Python version: 3.6.4
Related modules:
scrapy module;
jieba module;
pyecharts module;
folium module;
wordcloud module;
fake_useragent module;
And some Python modules.
environment construction
Install Python and add it to the environment variables, pip install the relevant modules you need.
data crawling
First, create a new project:
Then open the China Seismological Network:
http://news.ceic.ac.cn/index.html
It is found that seismic data within a specified time and latitude range can be queried by using the query function that comes with the website:
picture
OK, start writing code.
First define the data we want to crawl in the items.py file:
class EarthquakeItem(scrapy.Item):
Create a main.py function under spiders folder to write our crawler main program, where we crawl all the earthquake data recorded on the website since January 1, 2000 (in fact, after running the code, we found that there are only earthquake data T_T from 2012 in the website):
'''main'''
OK, that's it. Just run the following command under the first earthquake folder:
scrapy crawl earthquake -o eqdata.json -t json
The crawled data is saved in the eqdata.json file.
About how to use Python crawler Scrapy to crawl Chinese seismic data questions to share here, I hope the above content can be of some help to everyone, if you still have a lot of doubts, you can pay attention to the industry information channel to learn more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.