当前位置: 首页>>代码示例>>Python>>正文


Python Request.meta['name']方法代码示例

本文整理汇总了Python中scrapy.Request.meta['name']方法的典型用法代码示例。如果您正苦于以下问题:Python Request.meta['name']方法的具体用法?Python Request.meta['name']怎么用?Python Request.meta['name']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scrapy.Request的用法示例。


在下文中一共展示了Request.meta['name']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_poetryList

# 需要导入模块: from scrapy import Request [as 别名]
# 或者: from scrapy.Request import meta['name'] [as 别名]
	def parse_poetryList(self,response):
		poetrys = response.xpath('//div[@class="son2List"]/div/a')
		if len(poetrys) > 0:
			poetry_url = poetrys[0].xpath('./@href').extract()
			if len(poetry_url) >0 :
				poetry_url = self.home_url + poetry_url[0]
				request = Request(url = poetry_url, callback=self.parse_poetry)
				request.meta['name'] = response.meta['name']
				request.meta['setUrl'] = response.meta['setUrl']
				request.meta['descrip'] = response.meta['descrip']			
				yield request
开发者ID:Geekking,项目名称:pinlocation,代码行数:13,代码来源:PoetSpider.py

示例2: parse_poetry

# 需要导入模块: from scrapy import Request [as 别名]
# 或者: from scrapy.Request import meta['name'] [as 别名]
	def parse_poetry(self,response):
		poets = response.xpath('//div[@class="son2Title"]/div/a')
		if len(poets) > 0:
			poet_url = poets[0].xpath('./@href').extract()
			if len(poet_url) > 0:
				poetpageurl = poet_url[0]
				request = Request(url = poetpageurl, callback=self.parse_authorPage)
				print poetpageurl
				request.meta['name'] = response.meta['name']
				request.meta['setUrl'] = response.meta['setUrl']
				request.meta['descrip'] = response.meta['descrip']	
				yield request
开发者ID:Geekking,项目名称:pinlocation,代码行数:14,代码来源:PoetSpider.py

示例3: parse_item

# 需要导入模块: from scrapy import Request [as 别名]
# 或者: from scrapy.Request import meta['name'] [as 别名]
	def parse_item(self,response):
		poet = response.xpath('//div[@class="son2AuthorCont"]')
		poet_title = poet.xpath('./div[@class="authorTile"]/strong/text()').extract()
		poetryUrls = poet.xpath('./div[@class="authorTile"]/a/@href').extract()
		poet_poetrySetUrl = self.home_url
		poet_descrip = poet.xpath('./div[@class="authorShow"]//p/text()').extract()

		if len(poet_descrip) <=0 :
			poet_descrip = poet.xpath('./div[@class="authorShow"]/text()').extract()
		
		if len(poetryUrls) > 0:
			poet_poetrySetUrl   += poetryUrls[0]
			request = Request(url = poet_poetrySetUrl, callback=self.parse_poetryList)
			request.meta['name'] = poet_title[0]
			request.meta['setUrl'] = poet_poetrySetUrl
			request.meta['descrip'] = ("".join(poet_descrip)).strip()			
			yield request
开发者ID:Geekking,项目名称:pinlocation,代码行数:19,代码来源:PoetSpider.py


注:本文中的scrapy.Request.meta['name']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。