Browse Source

Fix SeLoger pagination

Phyks (Lucas Verney) 7 months ago
parent
commit
7fc9077520
1 changed files with 10 additions and 7 deletions
  1. 10
    7
      modules/seloger/pages.py

+ 10
- 7
modules/seloger/pages.py View File

@@ -72,7 +72,7 @@ class SearchResultsPage(HTMLPage):
72 72
 
73 73
         def next_page(self):
74 74
             page_nb = Dict('navigation/pagination/page')(self)
75
-            max_results = Dict('navigation/pagination/maxResults')(self)
75
+            max_results = Dict('navigation/counts/count')(self)
76 76
             results_per_page = Dict('navigation/pagination/resultsPerPage')(self)
77 77
 
78 78
             if int(max_results) / int(results_per_page) > int(page_nb):
@@ -85,7 +85,7 @@ class SearchResultsPage(HTMLPage):
85 85
 
86 86
             def condition(self):
87 87
                 return (
88
-                    Dict('cardType')(self) not in ['advertising', 'localExpert']
88
+                    Dict('cardType')(self) not in ['advertising', 'ali', 'localExpert']
89 89
                     and Dict('id', default=False)(self)
90 90
                     and Dict('classifiedURL', default=False)(self)
91 91
                 )
@@ -171,11 +171,14 @@ class HousingPage(HTMLPage):
171 171
 
172 172
         def obj_type(self):
173 173
             idType = Dict('idTransactionType')(self)
174
-            type = next(k for k, v in TYPES.items() if v == idType)
175
-            if type == POSTS_TYPES.FURNISHED_RENT:
176
-                # SeLoger does not let us discriminate between furnished and not furnished.
177
-                return POSTS_TYPES.RENT
178
-            return type
174
+            try:
175
+                type = next(k for k, v in TYPES.items() if v == idType)
176
+                if type == POSTS_TYPES.FURNISHED_RENT:
177
+                    # SeLoger does not let us discriminate between furnished and not furnished.
178
+                    return POSTS_TYPES.RENT
179
+                return type
180
+            except StopIteration:
181
+                return NotAvailable
179 182
 
180 183
         def obj_advert_type(self):
181 184
             if 'Agences' in self.agency_doc['type']: