[leboncoin] fix bugs ( 'Hier' date parsing + getting photo.data)
This commit is contained in:
parent
3e1a8b735a
commit
3297651bdc
2 changed files with 4 additions and 3 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue