コード例 #1
0
	def parse_dir_contents(self, response):
		item = FundrazrItem()

		# Getting Campaign Title
		item['campaignTitle'] = response.xpath("//div[contains(@id, 'campaign-title')]/descendant::text()").extract()[0].strip()

		# Getting Amount Raised
		item['amountRaised']= response.xpath("//span[contains(@class, 'stat')]/span[contains(@class, 'amount-raised')]/descendant::text()").extract()

		# Goal
		item['goal'] = " ".join(response.xpath("//div[contains(@class, 'stats-primary with-goal')]//span[contains(@class, 'stats-label hidden-phone')]/text()").extract()).strip()

		# Currency Type (US Dollar Etc)
		item['currencyType'] = response.xpath("//div[contains(@class, 'stats-primary with-goal')]/@title").extract()

		# Campaign End (Month year etc)
		item['endDate'] = "".join(response.xpath("//div[contains(@id, 'campaign-stats')]//span[contains(@class,'stats-label hidden-phone')]/span[@class='nowrap']/text()").extract()).strip()

		# Number of contributors
		item['numberContributors'] = response.xpath("//div[contains(@class, 'stats-secondary with-goal')]//span[contains(@class, 'donation-count stat')]/text()").extract()

		# Getting Story
		story_list = response.xpath("//div[contains(@id, 'full-story')]/descendant::text()").extract()
		story_list = [x.strip() for x in story_list if len(x.strip()) > 0]
		item['story']  = " ".join(story_list)

		# Url (The link to the page)
		item['url'] = response.xpath("//meta[@property='og:url']/@content").extract()

		yield item
コード例 #2
0
    def parse_dir_contents(self, response):
        item = FundrazrItem()

        # Getting Campaign Title
        item['leader'] = response.xpath(
            "/a[contains(@class, 'white')]//@href").extract()

        yield item
コード例 #3
0
	def parse_dir_contents(self, response):
		item = FundrazrItem()

		# Getting Campaign Title
		item['campaignTitle'] = response.xpath("//*[@id='campaign-title']/text()").extract()[0].strip()

		# Getting Amount Raised
		item['amountRaised']= response.xpath("//*[@id='campaign-stats']/div[1]/span[1]/span[2]/text()").extract()

		# Currency Type (US Dollar Etc)
		item['currencyType'] = response.xpath("//*[@id='campaign-stats']/div[1]/@title").extract()

		# Goal
		item['percent_complete'] = response.xpath("//*[@id='campaign-stats']/div[1]/span[3]/span/text()").extract()

		# Goal
		item['goal'] = response.xpath("//*[@id='campaign-stats']/div[1]/span[3]/text()").extract()[1].strip()

		# Number of contributors
		item['numberContributors'] = response.xpath("//*[@id='campaign-stats']/div[2]/span[1]/text()").extract()

		# Number of updates
		item['updates'] = response.xpath("//*[@id='feed-nav']/li[2]/a/span/text()").extract()

		# Number of activities posted
		item['activities'] = response.xpath("//*[@id='feed-nav']/li[3]/a/span/text()").extract()

		# Time left
		item['timeLeft'] = response.xpath("//*[@id='campaign-stats']/div[3]/span/span[1]/text()").extract()

		# Days or weeks or year
		item['period'] = response.xpath("//*[@id='campaign-stats']/div[3]/span/span[2]/text()").extract()

		# Media count
		item['mediaCount'] = response.xpath("//*[@id='video-link']/a[2]/span/span/text()").extract()

		yield item