试着刮这部分:“酒廊,淋浴,储物柜”https://i.stack.imgur.com/k5mzg.png
<div class="CourseAbout-otherFacilities more">
<h3 class="CourseAbout-otherFacilities-title">Available Facilities</h3> " Lounge, Showers, Lockers "
</div>网址:https://www.golfadvisor.com/courses/16929-black-at-bethpage-state-park-golf-course
response.css('.CourseAbout-foodAndBeverage.more::text').get()命令返回“\n”
谢谢
发布于 2020-12-01 00:17:32
目标中有三个文本元素(由CSS表达式匹配):
<div class="CourseAbout-otherFacilities more">FIRST<h3
<h3 class="CourseAbout-otherFacilities-title">SECOND</h3>
</h3>THIRD</div>通过使用.get(),您可以告诉Scrapy返回first match。
我建议在这里使用XPath表达式,并通过文本匹配元素:
//h3[.="Available Facilities"]/following-sibling::text()[1]'https://stackoverflow.com/questions/65081409
复制相似问题