[weboob] [PATCH 1/1] seloger: Fix pagination

Benjamin CARTON carton_ben at yahoo.fr
Tue Jan 3 15:26:35 CET 2017

Your patch is working and fix the bug !

Anyway, I think that you could use CleanText options' instead of importing "re" to fix it.

To my mind, such a line could work:  CleanText('//pageSuivante', default=None, symbols=[u'http://ws.seloger.com/'])(self)

If not, you could also have a look at replace option.


    Le Lundi 2 janvier 2017 19h22, Simon Lipp <laiquo at hwold.net> a écrit :

 Right now webservices of seloger.com have a bug and returns an
invalid URL for next page (http://ws.seloger.com/http://ws.seloger.com/search.xml).

Work around that by deleting everyting before the last "http://" in the

Signed-off-by: Simon Lipp <laiquo at hwold.net>
 modules/seloger/pages.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/seloger/pages.py b/modules/seloger/pages.py
index 8d6a58ef0..51f220ae6 100644
--- a/modules/seloger/pages.py
+++ b/modules/seloger/pages.py
@@ -17,6 +17,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with weboob. If not, see <http://www.gnu.org/licenses/>.
+import re
 from weboob.browser.pages import XMLPage, JsonPage, pagination
 from weboob.browser.elements import ItemElement, ListElement, DictElement, method
@@ -69,7 +70,7 @@ class SearchResultsPage(XMLPage):
        def next_page(self):
            page = CleanText('//pageSuivante', default=None)(self)
            if page:
-                return page
+                return re.sub(r'.+http://', 'http://', page)
        class item(SeLogerItem):
            def obj_photos(self):

weboob mailing list
weboob at lists.symlink.me

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.symlink.me/pipermail/weboob/attachments/20170103/d68429e7/attachment.htm>

More information about the weboob mailing list