mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Get Books: Update plugin for Publio to handle changes to the website
Merge branch 'master' of https://github.com/t3d/calibre
This commit is contained in:
commit
657a13ba8b
@ -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__ = '2012-2014, Tomasz Długosz <tomek3d@gmail.com>'
|
__copyright__ = '2012-2015, Tomasz Długosz <tomek3d@gmail.com>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
@ -44,27 +44,19 @@ class PublioStore(BasicStoreConfig, StorePlugin):
|
|||||||
while counter:
|
while counter:
|
||||||
with closing(br.open('http://www.publio.pl/szukaj,strona' + str(page) + '.html?q=' + urllib.quote(query) + '§ions=EMAGAZINE§ions=MINIBOOK§ions=EBOOK', timeout=timeout)) as f:
|
with closing(br.open('http://www.publio.pl/szukaj,strona' + str(page) + '.html?q=' + urllib.quote(query) + '§ions=EMAGAZINE§ions=MINIBOOK§ions=EBOOK', timeout=timeout)) as f:
|
||||||
doc = html.fromstring(f.read())
|
doc = html.fromstring(f.read())
|
||||||
for data in doc.xpath('//div[@class="item"]'):
|
for data in doc.xpath('//div[@class="product-tile"]'):
|
||||||
if counter <= 0:
|
if counter <= 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
id = ''.join(data.xpath('.//div[@class="img"]/a/@href'))
|
id = ''.join(data.xpath('.//a[@class="product-tile-cover"]/@href'))
|
||||||
if not id:
|
if not id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cover_url = ''.join(data.xpath('.//div[@class="img"]/a/img/@data-original'))
|
cover_url = ''.join(data.xpath('.//img[@class="product-tile-cover-photo"]/@src'))
|
||||||
title = ''.join(data.xpath('.//div[@class="img"]/a/@title'))
|
title = ''.join(data.xpath('.//h3[@class="product-tile-title"]/a/text()'))
|
||||||
title2 = ''.join(data.xpath('.//div[@class="desc"]/h5//text()'))
|
author = ', '.join(data.xpath('.//span[@class="product-tile-author"]/a/text()'))
|
||||||
if title2:
|
price = ''.join(data.xpath('.//div[@class="product-tile-price-wrapper "]/a/ins/text()'))
|
||||||
title = title + '. ' + title2
|
#formats = ', '.join([x.strip() for x in data.xpath('.//div[@class="formats"]/a/text()')])
|
||||||
if (''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/span/text()')).strip() == "Seria:"):
|
|
||||||
series = ''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/a/@title'))
|
|
||||||
title = title + ' (seria ' + series + ')'
|
|
||||||
author = ', '.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[@class="row"][1]/a/@title'))
|
|
||||||
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/ins/text()'))
|
|
||||||
if not price:
|
|
||||||
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/text()')).strip()
|
|
||||||
formats = ', '.join([x.strip() for x in data.xpath('.//div[@class="formats"]/a/text()')])
|
|
||||||
|
|
||||||
counter -= 1
|
counter -= 1
|
||||||
|
|
||||||
@ -74,8 +66,8 @@ class PublioStore(BasicStoreConfig, StorePlugin):
|
|||||||
s.author = author
|
s.author = author
|
||||||
s.price = price
|
s.price = price
|
||||||
s.detail_item = 'http://www.publio.pl' + id.strip()
|
s.detail_item = 'http://www.publio.pl' + id.strip()
|
||||||
s.drm = SearchResult.DRM_LOCKED if 'DRM' in formats else SearchResult.DRM_UNLOCKED
|
#s.drm = SearchResult.DRM_LOCKED if 'DRM' in formats else SearchResult.DRM_UNLOCKED
|
||||||
s.formats = formats.replace(' DRM','').strip()
|
#s.formats = formats.replace(' DRM','').strip()
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
if not doc.xpath('boolean(//a[@class="next"])'):
|
if not doc.xpath('boolean(//a[@class="next"])'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user