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>
<a href="htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>[/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
···
--
Posted via http://www.ruby-forum.com/.
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>
<a href="htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>[/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
<a href="htxp://www.xxxxxx/not-this-one/xxxxx/xxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
HTML
Nokogiri::HTML(text).xpath('//a[contains(@href,"/files/")]').map{|a| a[:href] }
=> ["htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx"]
···
On Sun, Oct 31, 2010 at 9:08 AM, Bigmac Turdsplash <i8igmac@aim.com> wrote:
--
Michael Fellinger
CTO, The Rubyists, LLC
Robert_K1
(Robert K.)
3
Or even
doc.xpath('//a[contains(@href,"/files/")]/@href').map(&:value)
Kind regards
robert
···
On Sun, Oct 31, 2010 at 7:24 AM, Michael Fellinger <m.fellinger@gmail.com> wrote:
On Sun, Oct 31, 2010 at 9:08 AM, Bigmac Turdsplash <i8igmac@aim.com> wrote:
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>
<a href="htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>
<a href="htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15</a>[/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
<a href="htxp://www.xxxxxx/not-this-one/xxxxx/xxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/nope/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
<a href="htxp://www.xxxxxx/or-this/xxxxxxx/xxxxxxxx" onclick=""
style="font-size:15"></a>
HTML
Nokogiri::HTML(text).xpath('//a[contains(@href,"/files/")]').map{|a| a[:href] }
=> ["htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx"]
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/