[senscritique] improve browser2 adaptation
This commit is contained in:
parent
bd4c0d29a1
commit
007d99faf5
1 changed files with 7 additions and 7 deletions
|
|
@ -23,7 +23,7 @@ from .calendar import SensCritiquenCalendarEvent
|
|||
from datetime import date, datetime, time, timedelta
|
||||
|
||||
from weboob.tools.browser2.page import HTMLPage, method, ItemElement, ListElement, JsonPage
|
||||
from weboob.tools.browser2.filters import Filter, Link, CleanText, Regexp
|
||||
from weboob.tools.browser2.filters import Filter, Link, CleanText, Regexp, Attr
|
||||
|
||||
|
||||
__all__ = ['AjaxPage', 'EventPage', 'JsonResumePage']
|
||||
|
|
@ -117,12 +117,12 @@ class AjaxPage(HTMLPage):
|
|||
|
||||
class Summary(Filter):
|
||||
def filter(self, el):
|
||||
title = el[0].xpath("div/img")[0].attrib['alt'].replace('Affiche ', '')
|
||||
channel_info = el[0].xpath("div/div[@class='elgr-data-channel']")
|
||||
title = Regexp(Attr('div/img', 'alt'), '^Affiche(.*)')(el[0])
|
||||
channel_info = el[0].xpath('div/div[@class="elgr-data-channel"]')
|
||||
if channel_info:
|
||||
channel = channel_info[0].text.strip()
|
||||
channel = CleanText('.')(channel_info[0])
|
||||
else:
|
||||
channel_info = el[0].xpath('div[@class="elgr-product-data"]/span')[0].attrib['class']
|
||||
channel_info = Attr('div[@class="elgr-product-data"]/span', 'class')(el[0])
|
||||
channel = self.page.CHANNELS_PARAM.get(channel_info)
|
||||
return u'%s - %s' % (title, channel)
|
||||
|
||||
|
|
@ -136,8 +136,8 @@ class Description(Filter):
|
|||
def filter(self, el):
|
||||
header = el[0].xpath("//div[@class='pvi-hero-product']")[0]
|
||||
|
||||
title = header.xpath("div[@class='d-rubric-inner']/h1")[0].text.strip()
|
||||
year = header.xpath("div[@class='d-rubric-inner']/small")[0].text.strip()
|
||||
title = CleanText("div[@class='d-rubric-inner']/h1")(header)
|
||||
year = CleanText("div[@class='d-rubric-inner']/small")(header)
|
||||
|
||||
_infos = header.xpath("ul[@class='pvi-product-specs']/li")
|
||||
infos = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue