In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use Python to climb Meituan tourist attractions review data", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to use Python to climb Meituan tourist attractions review data"!
Preface
The text and pictures of this article come from the network, only for learning, communication and use, do not have any commercial use, if you have any questions, please contact us in time to deal with.
This year's National Day is coming in half a month. I believe many friends are still very much looking forward to this short holiday. National Day is a short holiday of the year, and many friends choose to travel to spend it. There are many tourist cities and tourist attractions in China.
Project goal
Climb Meituan's comments on tourist attractions
Victim's website
[https://chs.meituan.com/](https://chs.meituan.com/) Code installation Library pip install requestspip install time Import tool import requestsimport time parsing website Crawl data for page in range (10,101,10): time.sleep (1) url = 'https://www.meituan.com/ptapi/poi/getcomment?id=1161635&offset=0&pageSize={}&sortType=1'.format(page) headers = {' Host': 'www.meituan.com',' Pragma':'no-cache', 'Referer':' https: / / www.meituan.com / zhoubianyou / 1161635 /' 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0 WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'} response = requests.get (url=url, headers=headers) html_data = response.json () info_data = html_data ['comments'] for i in info_data: info = I [' comment'] Save data for i in info_data: info = I ['comment'] with open (' Meituan comment .csv' Mode='a', encoding='utf-8-sig', newline='') as f: f.write (info) print (info) run code The effect is as follows
Thank you for your reading, the above is the content of "how to use Python to climb Meituan tourist attractions review data". After the study of this article, I believe you have a deeper understanding of how to use Python to climb Meituan tourist attractions review data, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.