# -*- coding: utf-8 -*-
import scrapy
from recipe_scraper.items import RecipeItem

class TwopeasandtheirpodSpider(scrapy.Spider):
    name = "twopeasandtheirpod"
    start_urls = ['http://www.twopeasandtheirpod.com/category/recipes/main-dishes/']

    # prepTime comes out in the following format: PT45M, or PT8H10M
    # Need to parse this to "45 minutes" or "8 hours 10 minutes"
    def parse(self, response):
        recipe = response.css("div.recipe")
        if recipe:
            yield RecipeItem(title = recipe.css("h2").css("span::text").extract_first(),
            URL = response.url,
            imgURL = recipe.css("div.recipebody").css("img").xpath("@src").extract_first(),
            description =  recipe.css("div.summary").css("p::text").extract_first(),
            cuisine = None,
            prepTime =  recipe.css("div.time").css("meta[itemprop=totalTime]").xpath("@content").extract_first())
        else:
            # archives div contains all blog posts, item div represents a
            # specific post

            # Including this section under else statement, since recipe pages
            # also have an archives div
            links = response.css("div.archives").css("div.item").css("a").xpath("@href").extract()
            if links:
                for link in links:
                    yield scrapy.Request(link, callback=self.parse)

@@ -1367,8 +1367,274 @@
 .parse)%0A
+%0A            # Use CSS selectors to find the next page button%0A            nextPage = response.css(%22div#wp_page_numbers%22).css(%22a:contains('%3E') ::attr(href)%22).extract_first()%0A            if nextPage:%0A                yield scrapy.Request(nextPage, callback=self.parse)%0A

Add recursive scraping of "Two Peas" main dishes