Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Information Collection of Baidu Map Merchants by python

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to achieve Baidu map merchant information collection by python". In daily operation, I believe many people have doubts about how to achieve Baidu map merchant information collection by python. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to realize Baidu map merchant information collection by python". Next, please follow the editor to study!

Project file tree Baidu merchant-baidumap folder-baidumap.py-demo.py (test script) usage

The relevant data can be obtained by writing parameters in the demo.py file. The specific usage is as follows:

Import the library and initialize

Remember, it must be at the same level as the baidumap folder, create a py file, import the library and import methods in the newly created py file

From baidumap.baidumap import Mapdata

Methods of the import osMapdata class:

Mapdata has the following methods: get the popular city of the word, get the data of the keyword of the specified city, and get the data of the keyword of the whole country.

Fetch_hot_citys (self,keyword) get the hot city of this keyword fetch_one_city_data (self, citycode, keyword) get the industry data of the specified city code specified keyword fetch_all_city_data (self,keyword) get the industry data of the national city designated keyword

My family is engaged in barbed wire fence business, today to climb them to climb our wire mesh business distribution in the country.

City code information city code information, Baidu "Baidu map city code".

# initialize and create a csv file to store data

Keyword = 'screen'

Citycode = 131city code of Beijing

Filepath = 'data.csv'

Sleeptime = 100 # adjust the access speed, default is 1000 (i.e. 1s)

Md = Mapdata (filepath=filepath,sleeptime=sleeptime)

# get a list of popular cities for this keyword on Baidu map

Hot_citys = md.fetch_hot_citys (keyword=keyword)

Print (hot_citys)

# obtain industry data for specified keywords in a specified city

Md.fetch_one_city_data (citycode=citycode, keyword=keyword)

# get the merchant information of this keyword in the country

Md.fetch_all_city_data (keyword=keyword) at this point, on the "python how to achieve Baidu map merchant information collection" on the end of the study, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report