From 66d82523628dad457d97981619c427cb8e1d51d1 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 27 Sep 2012 13:30:43 +0200 Subject: [PATCH] There is more than one div "acceuil_btn" --- modules/freemobile/pages/homepage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/freemobile/pages/homepage.py b/modules/freemobile/pages/homepage.py index 5e028a01..b50c8664 100644 --- a/modules/freemobile/pages/homepage.py +++ b/modules/freemobile/pages/homepage.py @@ -30,7 +30,10 @@ class HomePage(BasePage): def get_list(self): for divglobal in self.document.xpath('//div[@class="abonne"]'): - login = divglobal.xpath('//div[@class="acceuil_btn"]/a')[0].attrib['href'].split('=').pop() + for link in divglobal.xpath('//div[@class="acceuil_btn"]/a'): + login = link.attrib['href'].split('=').pop() + if login.isdigit(): + break divabo = divglobal.xpath('div[@class="idAbonne pointer"]')[0] owner = unicode(divabo.xpath('p')[0].text.replace(' - ', '')) phone = unicode(divabo.xpath('p/span')[0].text)