抓取 div 标签下引号内的文本

Scrape text under div tag that is in quotes

正在尝试抓取这部分内容:“休息室、淋浴间、储物柜” 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()命令returns“\n”

谢谢

您的目标 div 中有 三个 个文本元素(与您的 CSS 表达式匹配):

<div class="CourseAbout-otherFacilities more">FIRST<h3
<h3 class="CourseAbout-otherFacilities-title">SECOND</h3>
</h3>THIRD</div>

通过使用 .get() 你告诉 Scrapy return 第一个 匹配。

我建议在这里改用 XPath 表达式并按文本匹配您的元素:

//h3[.="Available Facilities"]/following-sibling::text()[1]'