Bezleputh
Committed by ntome
Builds for 1 pipeline failed in 2 minutes 21 seconds

[explorimmo] fix module: website got updated

......@@ -25,14 +25,14 @@ from .pages import CitiesPage, SearchPage, HousingPage, HousingPage2, PhonePage
class ExplorimmoBrowser(PagesBrowser):
BASEURL = 'https://www.explorimmo.com/'
cities = URL('rest/locations\?q=(?P<city>.*)', CitiesPage)
search = URL('resultat/annonces.html\?(?P<query>.*)', SearchPage)
housing_html = URL('annonce-(?P<_id>.*).html', HousingPage)
phone = URL('rest/classifieds/(?P<_id>.*)/phone', PhonePage)
housing = URL('rest/classifieds/(?P<_id>.*)',
'rest/classifieds/\?(?P<js_datas>.*)', HousingPage2)
BASEURL = 'https://immobilier.lefigaro.fr'
cities = URL('/rest/locations\?q=(?P<city>.*)', CitiesPage)
search = URL('/annonces/resultat/annonces.html\?(?P<query>.*)', SearchPage)
housing_html = URL('/annonce-(?P<_id>.*).html', HousingPage)
phone = URL('/rest/classifieds/(?P<_id>.*)/phone', PhonePage)
housing = URL('/rest/classifieds/(?P<_id>.*)',
'/rest/classifieds/\?(?P<js_datas>.*)', HousingPage2)
TYPES = {POSTS_TYPES.RENT: 'location',
POSTS_TYPES.SALE: 'vente',
......
......@@ -113,6 +113,7 @@ class SearchPage(HTMLPage):
obj_id = Attr('.', 'data-classified-id')
obj_type = Env('query_type')
obj_title = CleanText('./div/h2[@class="item-type"]')
def obj_advert_type(self):
if self.is_agency():
......@@ -133,8 +134,6 @@ class SearchPage(HTMLPage):
else:
return HOUSE_TYPES.OTHER
obj_title = CleanText('.//*[has-class("js-item-title")]')
def obj_location(self):
script = CleanText('./script')(self)
try:
......@@ -163,7 +162,7 @@ class SearchPage(HTMLPage):
r'de (.*) à .*',
default=0))(self)
if cost == 0:
return CleanDecimal(self.price_selector, default=NotLoaded)(self)
return CleanDecimal(self.price_selector, default=NotAvailable)(self)
else:
return cost
......@@ -180,7 +179,7 @@ class SearchPage(HTMLPage):
else:
return UTILITIES.UNKNOWN
obj_text = CleanText('./div/div/div[@itemprop="description"]')
obj_text = CleanText('./div/p[@itemprop="description"]')
obj_area = CleanDecimal(
Regexp(
obj_title,
......@@ -220,11 +219,7 @@ class SearchPage(HTMLPage):
return NotLoaded
def obj_photos(self):
url = Attr(
'.',
'data-img',
default=None
)(self)
url = CleanText('./div[has-class("default-img")]/img/@data-src')(self)
if url:
url = unquote(url)
if "http://" in url[3:]:
......
......@@ -27,10 +27,10 @@ class ExplorimmoTest(BackendTest, HousingTest):
FIELDS_ALL_HOUSINGS_LIST = [
"id", "type", "advert_type", "house_type", "title", "location",
"cost", "currency", "utilities", "text", "area", "url"
"utilities", "text", "area", "url"
]
FIELDS_ANY_HOUSINGS_LIST = [
"photos"
"photos", "cost", "currency"
]
FIELDS_ALL_SINGLE_HOUSING = [
"id", "url", "type", "advert_type", "house_type", "title", "area",
......