Skip to content

Commit

Permalink
confoo.ca done for 2010-2014
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayane committed Apr 14, 2014
1 parent d1326be commit 02c957a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pycon_speakers/spiders/confoo_ca.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from urlparse import urljoin

from scrapy.spider import Spider
from scrapy.selector import Selector
from scrapy.http import Request

from pycon_speakers.loaders import SpeakerLoader


class PyConSpider(Spider):
name = 'confoo.ca'
years = '2010,2011,2012,2013,2014'

def start_requests(self):
url = "http://confoo.ca/en/{0}/speakers"
years = [int(x) for x in self.years.split(',')]
for year in years:
meta = {'year': year}
yield Request(url.format(year), meta=meta,
callback=self._parse)

def _parse(self, response):
for section in Selector(response).xpath('//div[@class="speakers"]//div[@class="name"]'):
il = SpeakerLoader(selector=section)
il.add_xpath('name', '.')
il.add_value('year', str(response.meta['year']))
yield il.load_item()


0 comments on commit 02c957a

Please sign in to comment.