Example #1
0
 def parse_page(self, response):
     if 'tieba' not in response.url:
         return
         
     el = ExampleLoader(response=response)
     el.add_xpath('name', '//title[1]/text()')
     el.add_value('url', response.url)
     return el.load_item()
Example #2
0
 def parse_directory(self, response):
     hxs = HtmlXPathSelector(response)
     for li in hxs.select('//ul[@class="directory-url"]/li'):
         el = ExampleLoader(selector=li)
         el.add_xpath('name', 'a/text()')
         el.add_xpath('description', 'text()')
         el.add_xpath('link', 'a/@href')
         el.add_value('url', response.url)
         yield el.load_item()
Example #3
0
 def parse_directory(self, response):
     hxs = Selector(response)
     for li in hxs.xpath('//ul[@class="directory-url"]/li'):
         el = ExampleLoader(selector=li)
         el.add_xpath('name', 'a/text()')
         el.add_xpath('description', 'text()')
         el.add_xpath('link', 'a/@href')
         el.add_value('url', response.url)
         yield el.load_item()
Example #4
0
 def parse_directory(self, response):
     hxs = Selector(response)
     for li in hxs.xpath('//ul[@class="directory-url"]/li'):
         el = ExampleLoader(selector=li)
         el.add_xpath("name", "a/text()")
         el.add_xpath("description", "text()")
         el.add_xpath("link", "a/@href")
         el.add_value("url", response.url)
         yield el.load_item()
Example #5
0
 def parse_page(self, response):
     el = ExampleLoader(response=response)
     el.add_xpath('name', '//title[1]/text()')
     el.add_value('url', response.url)
     return el.load_item()