title: Trying to scrape data from a table without class or id using python scrapy
body: <p>I am trying to scrape data from <a href="http://rotoguru1.com/cgi-bin/hyday.pl?game=fd" rel="nofollow">http://rotoguru1.com/cgi-bin/hyday.pl?game=fd</a>. But the code below does not give me any answer. I think something is wrong with the table path or the xpath for the name variable. Could someone please help to identify the problem?</p>
  
  <pre><code>import scrapy
  
  from scrapy.contrib.spiders import CrawlSpider, Rule
  from scrapy.contrib.linkextractors import LinkExtractor
  from kevin.items import RotoguruItem
  from scrapy.selector import Selector, HtmlXPathSelector
  
  
  class RotoguruSpider(CrawlSpider):
  
     name = 'rotoguru1'
     allowed_domains = ['rotoguru1.com']
     start_urls = ['http://rotoguru1.com/cgi-bin/hyday.pl?']
     rules = [Rule(LinkExtractor(allow=['mon=\d+&amp;day=\d+&amp;game=fd']), callback='parse_item')]
  
  
     def parse_item(self, response):
         hxs = HtmlXPathSelector(response)
         tablepath= '//table[@cellspacing="5"]/tbody//tr[position()&gt;2]'
         rows = hxs.select(tablepath)
         items = []
  
         for row in rows:
            item = RotoguruItem()
            item['name'] = row.select("td[2]/a/text()").extract()
            items.append(item)
         return items
  </code></pre>
  
  <p>The output for the above codes is </p>
  
  <pre><code>H:\SourceDir\basketball&gt;scrapy crawl rotoguru1 -o fd.csv
  2015-03-19 18:52:40+0530 [scrapy] INFO: Scrapy 0.24.5 started (bot: basketball)
  2015-03-19 18:52:40+0530 [scrapy] INFO: Optional features available: ssl, http11
  
  2015-03-19 18:52:40+0530 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE'
  : 'basketball.spiders', 'FEED_FORMAT': 'csv', 'SPIDER_MODULES': ['basketball.spi
  ders'], 'FEED_URI': 'fd.csv', 'BOT_NAME': 'basketball'}
  2015-03-19 18:52:40+0530 [scrapy] INFO: Enabled extensions: FeedExporter, LogSta
  ts, TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState
  2015-03-19 18:52:40+0530 [scrapy] INFO: Enabled downloader middlewares: HttpAuth
  Middleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, Def
  aultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, Redirec
  tMiddleware, CookiesMiddleware, ChunkedTransferMiddleware, DownloaderStats
  2015-03-19 18:52:40+0530 [scrapy] INFO: Enabled spider middlewares: HttpErrorMid
  dleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddlew
  are
  2015-03-19 18:52:40+0530 [scrapy] INFO: Enabled item pipelines:
  2015-03-19 18:52:40+0530 [rotoguru1] INFO: Spider opened
  2015-03-19 18:52:40+0530 [rotoguru1] INFO: Crawled 0 pages (at 0 pages/min), scr
  aped 0 items (at 0 items/min)
  2015-03-19 18:52:40+0530 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6
  023
  2015-03-19 18:52:40+0530 [scrapy] DEBUG: Web service listening on 127.0.0.1:6080
  
  2015-03-19 18:52:41+0530 [rotoguru1] DEBUG: Crawled (200) &lt;GET http://rotoguru1.
  com/cgi-bin/hyday.pl?game=fd&gt; (referer: None)
  2015-03-19 18:52:41+0530 [rotoguru1] INFO: Closing spider (finished)
  2015-03-19 18:52:41+0530 [rotoguru1] INFO: Dumping Scrapy stats:
          {'downloader/request_bytes': 236,
           'downloader/request_count': 1,
           'downloader/request_method_count/GET': 1,
           'downloader/response_bytes': 17052,
           'downloader/response_count': 1,
           'downloader/response_status_count/200': 1,
           'finish_reason': 'finished',
           'finish_time': datetime.datetime(2015, 3, 19, 13, 22, 41, 513000),
           'log_count/DEBUG': 3,
           'log_count/INFO': 7,
           'response_received_count': 1,
           'scheduler/dequeued': 1,
           'scheduler/dequeued/memory': 1,
           'scheduler/enqueued': 1,
           'scheduler/enqueued/memory': 1,
           'start_time': datetime.datetime(2015, 3, 19, 13, 22, 40, 296000)}
  2015-03-19 18:52:41+0530 [rotoguru1] INFO: Spider closed (finished)
  </code></pre>
  
  <p>Thanks in advance for helping.</p>