Commit e614af29 authored by Bezleputh's avatar Bezleputh Committed by ntome

[explorimmo] fix module: website got updated

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