# Need script for the following problem

**URL:** <https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076>\
**Category:** Ruby\
**Created:** [November 11, 2008, 10:03pm UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076 "2008-11-11T22:03:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sita\_Rami\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e19adc/32.png) [@Sita\_Rami\_R](https://www.ruby-forum.com/u/Sita_Rami_R)\
**Post date:** [November 11, 2008, 10:03pm UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076/1 "2008-11-11T22:03:53Z")

</div>

Hi,  
My problem is folows

Opened google and entered pickaxe and clicked search

in the page followed, i want to collect all the page titles which are in  
green color and all the corresponding links in a log file.  
i want to repeat the same for 10 pages(google searched) …

please help me

---

<div class="post-metadata">

**Author:** ![Sita\_Rami\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e19adc/32.png) [@Sita\_Rami\_R](https://www.ruby-forum.com/u/Sita_Rami_R)\
**Post date:** [November 12, 2008, 9:35am UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076/2 "2008-11-12T09:35:05Z")

</div>

On Tue, Nov 11, 2008 at 10:00 PM, Sita Rami R.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,  
> My problem is folows
> 
> Opened google and entered pickaxe and clicked search
> 
> in the page followed, i want to collect all the page titles which are in  
> green color and all the corresponding links in a log file.  
> i want to repeat the same for 10 pages(google searched) …
> 
> please help me

Take a look at mechanize, or search the archives or google for “web  
scraping”.  
There’s a lot of info out there. If you get stuck with something just  
let us know,  
post some code and we’ll help you.

Jesus.

---

<div class="post-metadata">

**Author:** ![Sita\_Rami\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e19adc/32.png) [@Sita\_Rami\_R](https://www.ruby-forum.com/u/Sita_Rami_R)\
**Post date:** [November 12, 2008, 10:07am UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076/3 "2008-11-12T10:07:23Z")

</div>

2008/11/12 Jesús Gabriel y Galán [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > please help me
> 
> Take a look at mechanize, or search the archives or google for “web scraping”.  
> There’s a lot of info out there. If you get stuck with something just  
> let us know,  
> post some code and we’ll help you.

Sita, to make it crystal clear: this is not the service “We code it  
for you” with its free new subscribers offer. You’ll have to invest a  
bit more to get your problem solved (either you hand it off to a  
contractor which I am sure will happily provide what you need and bill  
you or start writing it yourself and see how far you get).

Terms of usage can be found at  
[http://www.catb.org/~esr/faqs/smart-questions.html](http://www.catb.org/~esr/faqs/smart-questions.html)

robert

---

<div class="post-metadata">

**Author:** ![Sita\_Rami\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e19adc/32.png) [@Sita\_Rami\_R](https://www.ruby-forum.com/u/Sita_Rami_R)\
**Post date:** [November 23, 2008, 8:02pm UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076/4 "2008-11-23T20:02:00Z")

</div>

On 2008-11-11, Sita Rami R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Opened google and entered pickaxe and clicked search
> 
> in the page followed, i want to collect all the page titles which are in  
> green color and all the corresponding links in a log file.  
> i want to repeat the same for 10 pages(google searched) …

That’s a particularly efficient way of doing it. Google actually has an  
API. You can use it with two Ruby gems: curb and json.

See [http://code.google.com/apis/ajaxsearch/documentation/#fonje](http://code.google.com/apis/ajaxsearch/documentation/#fonje) for  
details on how to use Google’s API. I have some example code up for how  
to do this in Ruby here [http://gist.github.com/16735](http://gist.github.com/16735).

You’ll have to use your own initiative from here on out (preferably  
following How To Ask Questions The Smart Way at:  
[http://www.catb.org/~esr/faqs/smart-questions.html](http://www.catb.org/~esr/faqs/smart-questions.html))

Yours,

---

<div class="post-metadata">

**Author:** ![Sita\_Rami\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e19adc/32.png) [@Sita\_Rami\_R](https://www.ruby-forum.com/u/Sita_Rami_R)\
**Post date:** [November 23, 2008, 8:40pm UTC](https://www.ruby-forum.com/t/need-script-for-the-following-problem/153076/5 "2008-11-23T20:40:50Z")

</div>

On 2008-11-11, Sita Rami R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Opened google and entered pickaxe and clicked search
> 
> in the page followed, i want to collect all the page titles which are in  
> green color and all the corresponding links in a log file.  
> i want to repeat the same for 10 pages(google searched) …

That’s a particularly inefficient way of doing it. Google actually has  
an  
API. You can use it with two Ruby gems: curb and json.

See [http://code.google.com/apis/ajaxsearch/documentation/#fonje](http://code.google.com/apis/ajaxsearch/documentation/#fonje) for  
details on how to use Google’s API. I have some example code up for how  
to do this in Ruby here [http://gist.github.com/16735](http://gist.github.com/16735).

You’ll have to use your own initiative from here on out (preferably  
following How To Ask Questions The Smart Way at:  
[http://www.catb.org/~esr/faqs/smart-questions.html](http://www.catb.org/~esr/faqs/smart-questions.html))

Yours,
