ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
all other gems are freshly updated
I am trying to download text files from a site. The site requires
sign-up, sorry about that.
The following code hopefully gets elements I want.
I used Chrome console, “$x()” to confirm the xpath works for (at least)
But it does not gets the elements as Chrome does.
Could anyone tell me why?
url = ‘https://www.coursera.org/modelthinking/lecture/index’
xpather = ‘//div[@class=“item_resource”]’
html = Nokogiri::HTML(open(url))
i = 0
html.xpath(xpather).each do |link|
i += 1
Thanks in advance