im not sure how to ask this question…
Imagen the body of a webpage as the string im searching threw…
[body]
<a href=“htxp://www.xxxxxx/not-this-one/xxxxx/xxxxxx” onclick=""
style=“font-size:15
<a href=“htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx” onclick=”"
style=“font-size:15
<a href=“htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx” onclick=”"
style=“font-size:15
<a href=“htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx” onclick=”"
style="font-size:15[/body]
i need to find this /files/ then on the left side and right side there
are quotes “<------/files/------>”
i need all the data in between each quote, this will be a download link
my script will need to find…
im not sure how to do this… please help if you can
i8igmac
2
On Sun, Oct 31, 2010 at 7:24 AM, Michael F.
[email protected] wrote:
style="font-size:15
HTML
Nokogiri::HTML(text).xpath(‘//a[contains(@href,“/files/”)]’).map{|a| a[:href]
}
=> [“htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx”]
Or even
doc.xpath(‘//a[contains(@href,“/files/”)]/@href’).map(&:value)
Kind regards
robert
On Sun, Oct 31, 2010 at 9:08 AM, Bigmac T. [email protected]
wrote:
<a href=“htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx” onclick=“”
style="font-size:15[/body]
i need to find this /files/ then on the left side and right side there
are quotes “<------/files/------>”
i need all the data in between each quote, this will be a download link
my script will need to find…
im not sure how to do this… please help if you can
require ‘nokogiri’
text = <<HTML
HTML
Nokogiri::HTML(text).xpath(‘//a[contains(@href,“/files/”)]’).map{|a| a[:href] }
=> [“htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx”]