mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get Books: Fix Foyles UK store plugin. Fixes #1181494 (Foyles UK listed as DRM free, but isn't)
This commit is contained in:
commit
3da5f5a2d5
@ -1,7 +1,7 @@
|
|||||||
# -*- 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 = 1 # Needed for dynamic plugin loading
|
store_version = 2 # Needed for dynamic plugin loading
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
__license__ = 'GPL 3'
|
||||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||||
@ -54,14 +54,13 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin):
|
|||||||
id_ = ''.join(data.xpath('.//p[@class="doc-cover"]/a/@href')).strip()
|
id_ = ''.join(data.xpath('.//p[@class="doc-cover"]/a/@href')).strip()
|
||||||
if not id_:
|
if not id_:
|
||||||
continue
|
continue
|
||||||
|
id_ = 'http://ebooks.foyles.co.uk' + id_
|
||||||
|
|
||||||
cover_url = ''.join(data.xpath('.//p[@class="doc-cover"]/a/img/@src'))
|
cover_url = ''.join(data.xpath('.//p[@class="doc-cover"]/a/img/@src'))
|
||||||
title = ''.join(data.xpath('.//span[@class="title"]/a/text()'))
|
title = ''.join(data.xpath('.//span[@class="title"]/a/text()'))
|
||||||
author = ', '.join(data.xpath('.//span[@class="author"]/span[@class="author"]/text()'))
|
author = ', '.join(data.xpath('.//span[@class="author"]/span[@class="author"]/text()'))
|
||||||
price = ''.join(data.xpath('.//span[@itemprop="price"]/text()'))
|
price = ''.join(data.xpath('.//span[@itemprop="price"]/text()')).strip()
|
||||||
format_ = ''.join(data.xpath('.//p[@class="doc-meta-format"]/span[last()]/text()'))
|
format_ = ''.join(data.xpath('.//p[@class="doc-meta-format"]/span[last()]/text()'))
|
||||||
format_, ign, drm = format_.partition(' ')
|
|
||||||
drm = SearchResult.DRM_LOCKED if 'DRM' in drm else SearchResult.DRM_UNLOCKED
|
|
||||||
|
|
||||||
counter -= 1
|
counter -= 1
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin):
|
|||||||
s.author = author.strip()
|
s.author = author.strip()
|
||||||
s.price = price
|
s.price = price
|
||||||
s.detail_item = id_
|
s.detail_item = id_
|
||||||
s.drm = drm
|
s.drm = SearchResult.DRM_LOCKED
|
||||||
s.formats = format_
|
s.formats = format_
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user