[PopolEmploi] correct bug that occurs while parsing pages
This commit is contained in:
parent
56e9476e3a
commit
fa02fc4aa4
1 changed files with 29 additions and 15 deletions
|
|
@ -67,23 +67,37 @@ class AdvertPage(BasePage):
|
||||||
advert.society_name = u'%s' % society_name[0].text
|
advert.society_name = u'%s' % society_name[0].text
|
||||||
|
|
||||||
advert.url = url
|
advert.url = url
|
||||||
advert.place = u'%s' % self.parser.select(content,
|
place = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/ul/li[@itemprop="addressRegion"]',
|
'ul/li/div[@class="value"]/ul/li[@itemprop="addressRegion"]',
|
||||||
1, method='xpath').text.strip()
|
1, method='xpath').text
|
||||||
|
if place:
|
||||||
|
advert.place = place.strip()
|
||||||
|
|
||||||
advert.contract_type = u'%s' % self.parser.select(content,
|
contract_type = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/span[@itemprop="employmentType"]',
|
'ul/li/div[@class="value"]/span[@itemprop="employmentType"]',
|
||||||
1, method='xpath').text.strip()
|
1, method='xpath').text
|
||||||
|
|
||||||
advert.experience = u'%s' % self.parser.select(content,
|
if contract_type:
|
||||||
|
advert.contract_type = contract_type.strip()
|
||||||
|
|
||||||
|
experience = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/span[@itemprop="experienceRequirements"]',
|
'ul/li/div[@class="value"]/span[@itemprop="experienceRequirements"]',
|
||||||
1, method='xpath').text.strip()
|
1, method='xpath').text
|
||||||
|
|
||||||
advert.formation = u'%s' % self.parser.select(content,
|
if experience:
|
||||||
|
advert.experience = experience.strip()
|
||||||
|
|
||||||
|
formation = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/span[@itemprop="qualifications"]',
|
'ul/li/div[@class="value"]/span[@itemprop="qualifications"]',
|
||||||
1, method='xpath').text.strip()
|
1, method='xpath').text
|
||||||
|
|
||||||
advert.pay = u'%s' % self.parser.select(content,
|
if formation:
|
||||||
|
advert.formation = formation.strip()
|
||||||
|
|
||||||
|
pay = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/span[@itemprop="baseSalary"]',
|
'ul/li/div[@class="value"]/span[@itemprop="baseSalary"]',
|
||||||
1, method='xpath').text.strip()
|
1, method='xpath').text
|
||||||
|
if pay:
|
||||||
|
advert.pay = pay.strip()
|
||||||
|
|
||||||
return advert
|
return advert
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue