mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Get books: Replace the koobe.pl store plugin with their new store Swiat Ebookow
Merge branch 'master' of https://github.com/t3d/calibre
This commit is contained in:
commit
75b7b476c7
@ -1638,18 +1638,6 @@ class StoreKoboStore(StoreBase):
|
||||
affiliate = True
|
||||
|
||||
|
||||
class StoreKoobeStore(StoreBase):
|
||||
name = 'Koobe'
|
||||
author = u'Tomasz Długosz'
|
||||
description = u'Księgarnia internetowa oferuje ebooki (książki elektroniczne) w postaci plików epub, mobi i pdf.'
|
||||
actual_plugin = 'calibre.gui2.store.stores.koobe_plugin:KoobeStore'
|
||||
|
||||
drm_free_only = True
|
||||
headquarters = 'PL'
|
||||
formats = ['EPUB', 'MOBI', 'PDF']
|
||||
affiliate = True
|
||||
|
||||
|
||||
class StoreLegimiStore(StoreBase):
|
||||
name = 'Legimi'
|
||||
author = u'Tomasz Długosz'
|
||||
@ -1790,6 +1778,18 @@ class StoreSmashwordsStore(StoreBase):
|
||||
affiliate = True
|
||||
|
||||
|
||||
class StoreSwiatEbookowStore(StoreBase):
|
||||
name = 'Świat Ebooków'
|
||||
author = u'Tomasz Długosz'
|
||||
description = u'Ebooki maje tę zaletę, że są zawsze i wszędzie tam, gdzie tylko nas dopadnie ochota na czytanie.'
|
||||
actual_plugin = 'calibre.gui2.store.stores.swiatebookow_plugin:SwiatEbookowStore'
|
||||
|
||||
drm_free_only = True
|
||||
headquarters = 'PL'
|
||||
formats = ['EPUB', 'MOBI', 'PDF']
|
||||
affiliate = True
|
||||
|
||||
|
||||
class StoreVirtualoStore(StoreBase):
|
||||
name = 'Virtualo'
|
||||
author = u'Tomasz Długosz'
|
||||
@ -1879,7 +1879,6 @@ plugins += [
|
||||
StoreGoogleBooksStore,
|
||||
StoreGutenbergStore,
|
||||
StoreKoboStore,
|
||||
StoreKoobeStore,
|
||||
StoreLegimiStore,
|
||||
StoreLibreDEStore,
|
||||
StoreLitResStore,
|
||||
@ -1893,6 +1892,7 @@ plugins += [
|
||||
StorePublioStore,
|
||||
StoreRW2010Store,
|
||||
StoreSmashwordsStore,
|
||||
StoreSwiatEbookowStore,
|
||||
StoreVirtualoStore,
|
||||
StoreWeightlessBooksStore,
|
||||
StoreWHSmithUKStore,
|
||||
|
@ -1,13 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 7 # Needed for dynamic plugin loading
|
||||
store_version = 8 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2012-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
|
||||
from lxml import html
|
||||
@ -25,13 +26,19 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
class PublioStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def open(self, parent=None, detail_item=None, external=False):
|
||||
google_analytics = '?utm_source=tdcalibre&utm_medium=calibre'
|
||||
url = 'http://www.publio.pl/' + google_analytics
|
||||
aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/29/58/'
|
||||
url = 'http://www.publio.pl/'
|
||||
|
||||
aff_url = aff_root + str(b64encode(url))
|
||||
|
||||
detail_url = None
|
||||
if detail_item:
|
||||
detail_url = aff_root + str(b64encode(detail_item))
|
||||
|
||||
if external or self.config.get('open_external', False):
|
||||
open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
|
||||
open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
|
||||
else:
|
||||
d = WebStoreDialog(self.gui, url, parent, detail_item if detail_item else url)
|
||||
d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url)
|
||||
d.setWindowTitle(self.name)
|
||||
d.set_tags(self.config.get('tags', ''))
|
||||
d.exec_()
|
||||
|
@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2013-2016, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__copyright__ = '2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
@ -23,12 +23,12 @@ from calibre.gui2.store.search_result import SearchResult
|
||||
from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
|
||||
|
||||
class KoobeStore(BasicStoreConfig, StorePlugin):
|
||||
class SwiatEbookowStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def open(self, parent=None, detail_item=None, external=False):
|
||||
aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/15/58/'
|
||||
aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/181/58/'
|
||||
|
||||
url = 'http://www.koobe.pl/'
|
||||
url = 'https://www.swiatebookow.pl/'
|
||||
|
||||
aff_url = aff_root + str(b64encode(url))
|
||||
|
||||
@ -51,36 +51,33 @@ class KoobeStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
counter = max_results
|
||||
while counter:
|
||||
with closing(br.open('http://www.koobe.pl/s,p,' + str(page) + ',szukaj/fraza:' + urllib.quote(query), timeout=timeout)) as f:
|
||||
with closing(br.open('https://www.swiatebookow.pl/ebooki/?q=' + urllib.quote(query) + '&page=' + str(page), timeout=timeout)) as f:
|
||||
doc = html.fromstring(f.read().decode('utf-8'))
|
||||
for data in doc.xpath('//div[@class="seach_result"]/div[@class="result"]'):
|
||||
for data in doc.xpath('//div[@class="category-item-container"]//div[@class="book-large"]'):
|
||||
if counter <= 0:
|
||||
break
|
||||
|
||||
id = ''.join(data.xpath('.//div[@class="cover"]/a/@href'))
|
||||
id = ''.join(data.xpath('./a/@href'))
|
||||
if not id:
|
||||
continue
|
||||
|
||||
cover_url = ''.join(data.xpath('.//div[@class="cover"]/a/img/@src'))
|
||||
price = ''.join(data.xpath('.//span[@class="current_price"]/text()'))
|
||||
if not price:
|
||||
price = ''.join(data.xpath('.//div[@class="book_promo_price"]/span/text()'))
|
||||
title = ''.join(data.xpath('.//h2[@class="title"]/a/text()'))
|
||||
author = ', '.join(data.xpath('.//h3[@class="book_author"]/a/text()'))
|
||||
formats = ', '.join(data.xpath('.//div[@class="formats"]/div/div/@title'))
|
||||
cover_url = ''.join(data.xpath('.//div[@class="cover-xs"]/img/@src'))
|
||||
price = ''.join(data.xpath('.//span[@class="item-price"]/text()')+data.xpath('.//span[@class="sub-price"]/text()'))
|
||||
title = ''.join(data.xpath('.//h3/text()'))
|
||||
author = ', '.join(data.xpath('.//div[@class="details"]/p/a/text()'))
|
||||
|
||||
counter -= 1
|
||||
|
||||
s = SearchResult()
|
||||
s.cover_url = 'http://www.koobe.pl/' + cover_url
|
||||
s.cover_url = 'https://www.swiatebookow.pl' + cover_url
|
||||
s.title = title.strip()
|
||||
s.author = author.strip()
|
||||
s.price = price
|
||||
s.detail_item = 'http://www.koobe.pl' + id[1:]
|
||||
s.formats = formats.upper()
|
||||
s.detail_item = 'https://www.swiatebookow.pl' + id
|
||||
# s.formats = formats.upper()
|
||||
s.drm = SearchResult.DRM_UNLOCKED
|
||||
|
||||
yield s
|
||||
if not doc.xpath('//div[@class="site_bottom"]//a[@class="right"]'):
|
||||
if not doc.xpath('//div[@class="paging_bootstrap pagination"]//a[@class="next"]'):
|
||||
break
|
||||
page+=1
|
Loading…
x
Reference in New Issue
Block a user