class TrainSpider(scrapy.Spider):
    name = 'trip'
start_urls = ['somewebsite']

def parse(self, response):
    """ do something with this parser """
next_page = response.xpath("//a[@class='next_page']/@href").extract_first()
if next_page is not None:
    next_page = response.urljoin(next_page)
yield scrapy.Request(next_page, callback=self.parse)
scrapy - parsing items that are paginated