Commit 3297651b authored by Bezleputh's avatar Bezleputh

[leboncoin] fix bugs ( 'Hier' date parsing + getting photo.data)

parent 3e1a8b73
......@@ -51,7 +51,7 @@ class LeboncoinBackend(BaseBackend, CapHousing):
def fill_photo(self, photo, fields):
if 'data' in fields and photo.url and not photo.data:
photo.data = self.browser.readurl(photo.url)
photo.data = self.browser.open(photo.url).content
return photo
def search_city(self, pattern):
......
......@@ -22,7 +22,7 @@ from weboob.tools.browser2.page import HTMLPage, method, pagination
from weboob.tools.browser2.elements import ItemElement, ListElement
from weboob.tools.browser2.filters import CleanText, Link, Regexp, CleanDecimal, Env, DateTime, Attr
from weboob.capabilities.housing import City, Housing, HousingPhoto
from datetime import date
from datetime import date, timedelta
from weboob.tools.date import DATE_TRANSLATE_FR, LinearDateGuesser
......@@ -61,7 +61,8 @@ class HousingListPage(HTMLPage):
def obj_date(self):
_date = CleanText('./div[@class="lbc"]/div[@class="date"]',
replace=[('Aujourd\'hui', str(date.today().day))])(self)
replace=[('Aujourd\'hui', str(date.today().day)),
('Hier', str((date.today() - timedelta(1)).day))])(self)
for fr, en in DATE_TRANSLATE_FR:
_date = fr.sub(en, _date)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment