를 잡아 Scrapi 보석 문제 나는 다음과 같은 HTML이 :루비/레일 - 다음 DIV 텍스트
<div class="tvShow" align="left">
<div class="clearfix" style="margin:0px 0px;">
<h3 class="left" style="margin:0px 0px">FIRST TUESDAY BOOK CLUB WITH JENNIFER BYRNE</h3>
</div>
<div>Thursday 22nd December at 2.00 pm (60 minutes)</div>
<div><b>Channel: </b>ABC1</div>
...
</div>
나는 내용을 긁어하기 위해 scrapi
보석을 사용하고 있습니다.
이
내가 추출하기 위해 지금까지 무슨이다h3
:
channel_item = Scraper.define do
process "h3", :name => :text
end
# let scrapi begin
listings = Scraper.define do
array :programs
process "div.tvShow", :programs => channel_item
result :programs
end
# loop through the listings
listings.scrape(uri).each do |program|
puts program.name.titleize # h3 text
end
I 2.00시 (60 분)을하고 채널에서 목요일 22 12 월 추출하는 방법을 완전히 확실하지 않다 : ABC1 텍스트.
도움을 주시면 감사하겠습니다. 미리 감사드립니다.
JSON과 Nokogiri 버전에이 질문을 할 때 ScrAPI를 시도하는 이유는 무엇입니까? –
Nokogiri를 사용하여 * 모든 * 데이터를 가져올 수 있습니다. –