empik plugin: fix price detection

This commit is contained in:
Tomasz Długosz 2014-08-09 22:30:45 +02:00
parent 559d3f31f4
commit 9bd051b6bb

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 4 # Needed for dynamic plugin loading store_version = 5 # Needed for dynamic plugin loading
__license__ = 'GPL 3' __license__ = 'GPL 3'
__copyright__ = '2011-2013, Tomasz Długosz <tomek3d@gmail.com>' __copyright__ = '2011-2014, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import re import re
@ -55,7 +55,7 @@ class EmpikStore(BasicStoreConfig, StorePlugin):
title = ''.join(data.xpath('.//a[@class="productBox-450Title"]/text()')) title = ''.join(data.xpath('.//a[@class="productBox-450Title"]/text()'))
title = re.sub(r' \(ebook\)', '', title) title = re.sub(r' \(ebook\)', '', title)
author = ''.join(data.xpath('.//div[@class="productBox-450Author"]/a/text()')) author = ''.join(data.xpath('.//div[@class="productBox-450Author"]/a/text()'))
price = ''.join(data.xpath('.//div[@class="actPrice"]/text()')) price = ''.join(data.xpath('.//span[@class="currentPrice"]/text()'))
formats = ''.join(data.xpath('.//div[@class="productBox-450Type"]/text()')) formats = ''.join(data.xpath('.//div[@class="productBox-450Type"]/text()'))
formats = re.sub(r'Ebook *,? *','', formats) formats = re.sub(r'Ebook *,? *','', formats)
formats = re.sub(r'\(.*\)','', formats) formats = re.sub(r'\(.*\)','', formats)