From a9397dbfcf574c0a6d6a1e0d786d2b1705eeee1e Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Wed, 11 Dec 2013 20:29:21 +0100 Subject: [PATCH] [francetelevisions] fix #1282 --- modules/francetelevisions/browser.py | 1 + modules/francetelevisions/pages.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/francetelevisions/browser.py b/modules/francetelevisions/browser.py index 232b5fc1..5607bcb7 100644 --- a/modules/francetelevisions/browser.py +++ b/modules/francetelevisions/browser.py @@ -33,6 +33,7 @@ __all__ = ['PluzzBrowser'] class PluzzBrowser(BaseBrowser): DOMAIN = 'pluzz.francetv.fr' + ENCODING = 'utf-8' PAGES = {r'http://[w\.]*pluzz.francetv.fr/replay/1': IndexPage, r'http://[w\.]*pluzz.francetv.fr/recherche.*': IndexPage, r'http://[w\.]*pluzz.francetv.fr/videos/(.+).html': VideoPage, diff --git a/modules/francetelevisions/pages.py b/modules/francetelevisions/pages.py index 3d6b74f9..0362f16b 100644 --- a/modules/francetelevisions/pages.py +++ b/modules/francetelevisions/pages.py @@ -46,7 +46,11 @@ class IndexPage(BasePage): video.title = unicode(title.text.strip()) for p in div.xpath('.//p[@class="bientot"]'): video.title += ' - %s' % p.text.split('|')[0].strip() - video.date = parse_dt(div.find('span').attrib['data-date']) + date = div.xpath('.//p[@class="diffusion"]')[0].text.split('|')[0].strip() + pattern = re.compile(r'(\d{2}-\d{2}-\d{2})(.*?)(\d{2}:\d{2})') + match = pattern.search(date) + if match: + video.date = parse_dt("%s %s" % (match.group(1), match.group(3))) duration = div.xpath('.//span[@class="type-duree"]')[0].text.split('|')[1].strip() if duration[-1:] == "'": t = [0, int(duration[:-1])]