title: Scraping data from wikipedia using Scrapy - why/when do errors occur due to processing URLs?
body: <p>I am just starting to use Scrapy, and I am learning to use it as I go along. Please can someone explain why there is an error in my code, and what this error is? Is this error related to an invalid URL I have provided, and/or is it connected with invalid xpaths?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>from scrapy.spider import Spider
  from scrapy.selector import Selector
  
  class CatswikiSpider(Spider):
      name = "catswiki"
      allowed_domains = ["http://en.wikipedia.org/wiki/Cat‎"]
      start_urls = [
          "http://en.wikipedia.org/wiki/Cat‎"
  
      ]
  
      def parse(self, response):
          sel = Selector(response)
          sites = sel.xpath('//body/div')
          for site in sites:
              title = ('//h1/span/text()').extract()
              subtitle = ('//h2/span/text()').extract()
              boldtext = ('//p/b').extract()
              links = ('//a/@href').extract()
              imagelinks = ('//img/@src').re(r'.*cat.*').extract()
              print title, subtitle, boldtext, links, imagelinks
  
  
          #filename = response.url.split("/")[-2]
          #open(filename, 'wb').write(response.body)
  </code></pre>
  
  <p>And here are some attachments, showing the errors in the command prompt:</p>
  
  <p><img src="https://i.stack.imgur.com/bcWZP.png" alt="First section on the command prompt">
  <img src="https://i.stack.imgur.com/yS4HQ.png" alt="Final section on the command prompt"></p>