diff --git a/modules/boursorama/pages/account_history.py b/modules/boursorama/pages/account_history.py index d36a4534..87cc51fe 100644 --- a/modules/boursorama/pages/account_history.py +++ b/modules/boursorama/pages/account_history.py @@ -47,11 +47,15 @@ class AccountHistory(BasePage): def get_operations(self): for form in self.document.xpath('//form[@name="marques"]'): for tr in form.xpath('.//tbody/tr'): - if tr.attrib.get('class', '') == 'total': + if tr.attrib.get('class', '') == 'total' or 'style' in tr.attrib: continue - date = self.parser.tocleanstring(tr.cssselect('td.label span.DateOperation')[0]) - label = self.parser.tocleanstring(tr.cssselect('td.label span')[-1]) + date = self.parser.tocleanstring(tr.cssselect('td.operation span.DateOperation')[0]) + span = tr.cssselect('td.operation span, td.operation a')[-1] + # remove links + for font in span.xpath('./font'): + font.drop_tree() + label = self.parser.tocleanstring(span) amount = self.parser.tocleanstring(tr.cssselect('td.amount')[0]) try: diff --git a/modules/boursorama/pages/accounts_list.py b/modules/boursorama/pages/accounts_list.py index fd1c3c9c..3724ef58 100644 --- a/modules/boursorama/pages/accounts_list.py +++ b/modules/boursorama/pages/accounts_list.py @@ -42,7 +42,12 @@ class AccountsList(BasePage): break elif td.attrib.get('class', '') == 'account-name': - account.label = self.parser.tocleanstring(td.xpath('./span[@class="label"]')[0]) + try: + span = td.xpath('./span[@class="label"]')[0] + except IndexError: + # ignore account + break + account.label = self.parser.tocleanstring(span) account._link_id = td.xpath('.//a')[0].attrib['href'] elif td.attrib.get('class', '') == 'account-more-actions':