Store: Diesel drm status.

This commit is contained in:
John Schember 2011-04-19 20:40:11 -04:00
parent ebf4ee8fed
commit 7680faa48f

View File

@ -74,6 +74,13 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin):
price_elem = data.xpath('//td[@class="price"]/text()') price_elem = data.xpath('//td[@class="price"]/text()')
if price_elem: if price_elem:
price = price_elem[0] price = price_elem[0]
with closing(br.open('http://www.diesel-ebooks.com/item/' + id.strip(), timeout=timeout/4)) as nf:
idata = html.fromstring(nf.read())
if idata.xpath('boolean(//table[@class="format-info"]//tr[contains(th, "DRM") and contains(td, "No")])'):
drm = False
else:
drm = True
counter -= 1 counter -= 1
@ -83,5 +90,6 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin):
s.author = author.strip() s.author = author.strip()
s.price = price.strip() s.price = price.strip()
s.detail_item = '/item/' + id.strip() s.detail_item = '/item/' + id.strip()
s.drm = drm
yield s yield s