# Scrubyt scraper help

**URL:** <https://www.ruby-forum.com/t/scrubyt-scraper-help/195886>\
**Category:** Ruby\
**Created:** [October 1, 2010, 10:05pm UTC](https://www.ruby-forum.com/t/scrubyt-scraper-help/195886 "2010-10-01T22:05:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@camis](https://www.ruby-forum.com/u/camis)\
**Post date:** [October 1, 2010, 10:05pm UTC](https://www.ruby-forum.com/t/scrubyt-scraper-help/195886/1 "2010-10-01T22:05:12Z")

</div>

Hello all. I’m trying to build a simple web scraper to mine some data  
off the yellow pages. Specifically, this link:

> **[Best 30 Restaurants in Santa Barbara, CA with Reviews](https://www.yellowpages.com/santa-barbara-ca/restaurants)**
>
> Popular & reviewed Restaurants in Santa Barbara, CA. Find reviews, menus, or even order online - THE REAL YELLOW PAGES®

I’m scraping all the information that I need correctly. I’m very  
pleased about that! However, I’m only able to scrape the first page. I  
want my script to automatically go to the next page after the first one  
has been scraped, and the next after that. Scrubyt’s “next\_page”  
function can do this, but it can only use a full URL. On this website,  
however, the “Next” link at the bottom is a relative link. Is there any  
way I might be able to grab the URL of the website and add the relative  
link onto it, and then go to the next page? Or is there another way of  
doing it? I really appreciate the help! Thanks so much.

My code is as follows:

require ‘rubygems’  
require ‘scrubyt’

yellowpages\_data = Scrubyt::Extractor.define do

#Perform the action(s)  
fetch ‘[http://www.yellowpages.com/santa-barbara-ca/restaurants](http://www.yellowpages.com/santa-barbara-ca/restaurants)’

# This part does the scraping

listing “//div[@class=‘listing\_content’]” do  
name “Pascucci”  
#street “792 State St,”  
street “//span[@class=‘street-address’]”  
city “//span[@class=‘locality’]”  
state “//span[@class=‘region’]”  
zip\_code “//span[@class=‘postal-code’]”  
phone “//span[@class=‘business-phone phone’]”

```
       # This is the function I was talking about. It needs a full

```

link to work, but I only have a relative one!  
next\_page “Next”, :limit =\> 2  
end  
end

puts yellowpages\_data.to\_xml.write($stdout, 1)
