fix parsing on special cases
This commit is contained in:
parent
0419556b1b
commit
f9f6049019
2 changed files with 13 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue