如何只抓取活动 div

How to scrape only active div

我正在尝试抓取页面,我想获取未隐藏的 div...我正在使用 nokogiri 进行抓取。

status = doc.css('.fi-mu__m').map {|status| status.css('.fi-mu__score-info').css('.fi-s__status--abbr').css('.period .full_time').map(&:text)}

我需要其他东西来代替 .period.full_time

这是 DOM:

部分的副本
<div class="fi-s__status--abbr">

      <span class="period cancelled hidden">

    Annulé
      </span>
      <span class="period lineups hidden">

    Comp.
      </span>
      <span class="period half_time hidden">

    MT
      </span>
      <span class="period extra_time hidden">

    Fin 2ème MT
      </span>
      <span class="period extra_half_time hidden">

    End 1H ET
      </span>
      <span class="period penalty_shootout hidden">

    TAB
      </span>
      <span class="period full_time">

    Fin
      </span>
      <span class="period post_match  hidden">

    Fin
      </span>
      <span class="period minute hidden">0'</span>

            </div>

尝试.css('.period .full_time:not(.hidden)')

查看 :not operator