diff --git a/modules/freemobile/browser.py b/modules/freemobile/browser.py index db0df2ad..c53924d7 100644 --- a/modules/freemobile/browser.py +++ b/modules/freemobile/browser.py @@ -102,6 +102,6 @@ class Freemobile(BaseBrowser): def download_bill(self, id): assert isinstance(id, basestring) - date = id.split('.')[1] + bill = self.get_bill(id) - return self.readurl('/moncompte/ajax.php?page=facture&mode=html&date=' + date) + return self.readurl(bill._url) diff --git a/modules/freemobile/pages/history.py b/modules/freemobile/pages/history.py index d22481a8..58bef10f 100644 --- a/modules/freemobile/pages/history.py +++ b/modules/freemobile/pages/history.py @@ -61,7 +61,13 @@ class DetailsPage(BasePage): billid = billid[4:8] + billid[2:4] + billid[0:2] bill.id = num + "." + billid bill.date = date(*reversed([int(x) for x in mydate.split("-")])) - bill.format = u'html' + alink = trbill.find('td/a') + if alink.attrib.get("class") == "linkModal tips": + bill.format = u'html' + bill._url = alink.attrib.get('data-link') + else: + bill.format = u"pdf" + bill._url = alink.attrib.get('href') self.datebills.append(bill) def parse_div(self, divglobal, string, inter=False):