The class HotelSpiderSpider (scrapy. Spiders) :
Name='hotel_spider'
Allowed_domains=[' hotels.ctrip.com ']
# entry URL
Start_urls=[
'https://hotels.ctrip.com/hotel/Haikou42.html', # haikou
# # 'url1, city 1
# # 'url2, city 2
# # 'url3', city 3
# # 'url4', city 4
# 'url5', # 5 city
# # 'url6 city 6
]
In the default data parsing a single city hotels during the parse method
Is how to cycle to obtain the data of multiple hotel, turn to the great god, just an introduction to Python
CodePudding user response:
This web page must have a choice city list or find it is the json data put it off to get all the url of the cityCodePudding user response: