<form method="post" action="/M740/Biography/History/Drama/12+Years+a+Slave">
<input type="image" src="/public_site/webroot/cache/imdb/2024544_100.jpg" width="100" style="float:right;margin-left:2px;">
<strong><span style="color: rgb(255, 69, 0);">12 Years a Slave</span></strong>
<br>
In the antebellum United States, Solomon Northup, a free black man from upstate New York, is abducted and sold into slavery.<br>
<br><strong>Century Cinemax - Junction</strong><br>
<a href="tel:0774136246">0774136246</a>
<a href="tel:0208022073">0208022073</a>
<br>
12:10, 19:10, 21:40<br>
<br><strong>Fox Cineplex Sarit</strong><br>
<a href="tel:0203753025">0203753025</a>
<a href="tel:0720366208">0720366208</a>
<br>
11:00, 14:00, 18:00, 20:40<br>
<br><strong>Planet Media - Kisumu </strong><br>
<a href="tel:0731999100">0731999100</a>
<a href="tel:0724999100 & 0202629388">0724999100 & 0202629388</a>
<br>
12:00, 14:30, 20:30<br>
<br>
<input type="hidden" name="cinema" value="0">
<input type="hidden" name="searchMovie" value="0">
<input type="hidden" name="movie" value="740">
<input type="hidden" name="date" value="0">
<input type="hidden" name="groupId" value="0">
<input type="submit" name="ok" value="Further Details">
</form>
好吧,这只是我试图解析使用Nokogiri的一部分HTML。 html中的语义并不完整,我正在用Nokogiri获得想要的内容。作为参考,这是我想要废除的网站(http://flix.co.ke/Frontpage/Listings)解析内容不在html标签Nokogiri
到目前为止,我能够获得电影的标题,一个电影院和两个电话号码,但与我的方法我不能真正得到所有内容所需
这是我使用
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = "http://flix.co.ke/Frontpage/Listings"
doc = Nokogiri::HTML(open(url))
doc.css(".min-width div form").each do |entry|
title = entry.at_css("span").text
puts title
cinema = entry.at_css("br+ strong").text
puts cinema
phone = entry.at_css("a").text
puts phone
puts entry.at_css("a").next_element.text
end
有了这个我目前的剧本我只能够得到电影的title
,one cinema
和two contact numbers
所以我的样本输出的模样。
12 Years a Slave
Century Cinemax - Junction
0774136246
0208022073
47 Ronin 3D
Century Cinemax - Junction
0774136246
0208022073
Delivery Man
Century Cinemax - Junction
0774136246
0208022073
Frozen
Century Cinemax - Junction
0774136246
0208022073
(continued...)
有,只是在休息标记后称号后的描述,我无法得到这一点,并我怎么通过
标签内的所有电影院循环?以及逗号分隔的电话号码和个人演出时间。
我只是不知道从哪里开始。我会想取得这样的成绩对于这种情况
12年从
在战前美国,所罗门·诺萨普,一个自由的黑人男子从纽约州北部,被绑架并卖入奴隶制。
- 世纪Cinemax的 - 结 12:10,19:10,21:40
- 福克斯影城沙立 11:00,14:00,18:00,20:40
etc
任何帮助将不胜感激。在此先感谢
包含有效的HTML片段,而不是提取。为了帮助你,我们必须跳过篮球。 –