diff --git a/modules/explorimmo/browser.py b/modules/explorimmo/browser.py index b74d6e4c8d1374d873a8d9213f412aaf0c0369e4..c029a787a161a256be2fbff8aba91cd2099f3612 100644 --- a/modules/explorimmo/browser.py +++ b/modules/explorimmo/browser.py @@ -25,14 +25,14 @@ class ExplorimmoBrowser(PagesBrowser): - BASEURL = 'https://www.explorimmo.com/' - - cities = URL('rest/locations\?q=(?P.*)', CitiesPage) - search = URL('resultat/annonces.html\?(?P.*)', 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.*)', HousingPage2) + BASEURL = 'https://immobilier.lefigaro.fr' + + cities = URL('/rest/locations\?q=(?P.*)', CitiesPage) + search = URL('/annonces/resultat/annonces.html\?(?P.*)', 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.*)', HousingPage2) TYPES = {POSTS_TYPES.RENT: 'location', POSTS_TYPES.SALE: 'vente', diff --git a/modules/explorimmo/pages.py b/modules/explorimmo/pages.py index 4749f5284261d97aaefc660fc0bc46d7d0a0ef70..dac434acbe1bab9b2808b5ac366d9d40068feb63 100644 --- a/modules/explorimmo/pages.py +++ b/modules/explorimmo/pages.py @@ -113,6 +113,7 @@ def condition(self): 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 @@ def obj_house_type(self): 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 @@ def obj_cost(self): 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 @@ def obj_utilities(self): 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 @@ def obj_details(self): 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:]: diff --git a/modules/explorimmo/test.py b/modules/explorimmo/test.py index e005b2d0b60ce867cd4ada6691c5b2407731b030..f888a5c425afb21f4d7751a4a608a514fd4a7c9c 100644 --- a/modules/explorimmo/test.py +++ b/modules/explorimmo/test.py @@ -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",