示例#1
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_id = {
            'lid': '41000000033185143',
            'pubid': '21000000000352219',
            'ganpub': 'k352219',
            'ganclk': 'GOOG_1335334761',
        }
        # Use Kovid's affiliate id 30% of the time.
        if random.randint(1, 10) in (1, 2, 3):
            aff_id = {
                'lid': '41000000031855266',
                'pubid': '21000000000352583',
                'ganpub': 'k352583',
                'ganclk': 'GOOG_1335335464',
            }
            
        url = 'http://gan.doubleclick.net/gan_click?lid=%(lid)s&pubid=%(pubid)s' % aff_id
        if detail_item:
            detail_item += '&ganpub=%(ganpub)s&ganclk=%(ganclk)s' % aff_id

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#2
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_id = {
            'lid': '41000000033185143',
            'pubid': '21000000000352219',
            'ganpub': 'k352219',
            'ganclk': 'GOOG_1335334761',
        }
        # Use Kovid's affiliate id 30% of the time.
        if random.randint(1, 10) in (1, 2, 3):
            aff_id = {
                'lid': '41000000031855266',
                'pubid': '21000000000352583',
                'ganpub': 'k352583',
                'ganclk': 'GOOG_1335335464',
            }
            
        url = 'http://gan.doubleclick.net/gan_click?lid=%(lid)s&pubid=%(pubid)s' % aff_id
        if detail_item:
            detail_item += '&ganpub=%(ganpub)s&ganclk=%(ganclk)s' % aff_id

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#3
0
def search(query, max_results=10, timeout=60, write_raw_to=None):
    url = 'http://m.gutenberg.org/ebooks/search.opds/?query=' + quote_plus(query)

    counter = max_results
    br = browser(user_agent='calibre/'+__version__)
    with closing(br.open(url, timeout=timeout)) as f:
        raw = f.read()
        if write_raw_to is not None:
            with open(write_raw_to, 'wb') as f:
                f.write(raw)
        doc = etree.fromstring(raw)
        for data in doc.xpath('//*[local-name() = "entry"]'):
            if counter <= 0:
                break

            counter -= 1

            s = SearchResult()

            # We could use the <link rel="alternate" type="text/html" ...> tag from the
            # detail odps page but this is easier.
            id = fix_url(''.join(data.xpath('./*[local-name() = "id"]/text()')).strip())
            s.detail_item = url_slash_cleaner('%s/ebooks/%s' % (web_url, re.sub(r'[^\d]', '', id)))
            s.title = ' '.join(data.xpath('./*[local-name() = "title"]//text()')).strip()
            s.author = ', '.join(data.xpath('./*[local-name() = "content"]//text()')).strip()
            if not s.title or not s.author:
                continue

            # Get the formats and direct download links.
            with closing(br.open(id, timeout=timeout/4)) as nf:
                ndoc = etree.fromstring(nf.read())
                for link in ndoc.xpath('//*[local-name() = "link" and @rel = "http://opds-spec.org/acquisition"]'):
                    type = link.get('type')
                    href = link.get('href')
                    if type:
                        ext = mimetypes.guess_extension(type)
                        if ext:
                            ext = ext[1:].upper().strip()
                            s.downloads[ext] = fix_url(href)

            s.formats = ', '.join(s.downloads.keys())
            if not s.formats:
                continue

            for link in data.xpath('./*[local-name() = "link"]'):
                rel = link.get('rel')
                href = link.get('href')
                type = link.get('type')

                if rel and href and type:
                    href = fix_url(href)
                    if rel in ('http://opds-spec.org/thumbnail', 'http://opds-spec.org/image/thumbnail'):
                        if href.startswith('data:image/png;base64,'):
                            cdata = href.replace('data:image/png;base64,', '')
                            if not isinstance(cdata, bytes):
                                cdata = cdata.encode('ascii')
                            s.cover_data = base64.b64decode(cdata)

            yield s
示例#4
0
def search(query, max_results=10, timeout=60, write_raw_to=None):
    url = 'http://m.gutenberg.org/ebooks/search.opds/?query=' + urllib.quote_plus(query)

    counter = max_results
    br = browser(user_agent='calibre/'+__version__)
    with closing(br.open(url, timeout=timeout)) as f:
        raw = f.read()
        if write_raw_to is not None:
            with open(write_raw_to, 'wb') as f:
                f.write(raw)
        doc = etree.fromstring(raw)
        for data in doc.xpath('//*[local-name() = "entry"]'):
            if counter <= 0:
                break

            counter -= 1

            s = SearchResult()

            # We could use the <link rel="alternate" type="text/html" ...> tag from the
            # detail odps page but this is easier.
            id = ''.join(data.xpath('./*[local-name() = "id"]/text()')).strip()
            s.detail_item = fix_url(url_slash_cleaner('%s/ebooks/%s' % (web_url, re.sub('[^\d]', '', id))))
            if not s.detail_item:
                continue

            s.title = ' '.join(data.xpath('./*[local-name() = "title"]//text()')).strip()
            s.author = ', '.join(data.xpath('./*[local-name() = "content"]//text()')).strip()
            if not s.title or not s.author:
                continue

            # Get the formats and direct download links.
            with closing(br.open(id, timeout=timeout/4)) as nf:
                ndoc = etree.fromstring(nf.read())
                for link in ndoc.xpath('//*[local-name() = "link" and @rel = "http://opds-spec.org/acquisition"]'):
                    type = link.get('type')
                    href = link.get('href')
                    if type:
                        ext = mimetypes.guess_extension(type)
                        if ext:
                            ext = ext[1:].upper().strip()
                            s.downloads[ext] = fix_url(href)

            s.formats = ', '.join(s.downloads.keys())
            if not s.formats:
                continue

            for link in data.xpath('./*[local-name() = "link"]'):
                rel = link.get('rel')
                href = link.get('href')
                type = link.get('type')

                if rel and href and type:
                    href = fix_url(href)
                    if rel in ('http://opds-spec.org/thumbnail', 'http://opds-spec.org/image/thumbnail'):
                        if href.startswith('data:image/png;base64,'):
                            s.cover_data = base64.b64decode(href.replace('data:image/png;base64,', ''))

            yield s
    def search(self, query, max_results=10, timeout=60):
        url = 'http://ebookstore.sony.com/search?keyword=%s' % urllib.quote_plus(
            query)

        br = browser()

        counter = max_results
        with closing(br.open(url, timeout=timeout)) as f:
            doc = html.fromstring(f.read())
            for item in doc.xpath(
                    '//div[contains(@class, "searchResult")]/'
                    'descendant::li[contains(@class, "hreview")]'):
                if counter <= 0:
                    break

                curr = ''.join(
                    item.xpath(
                        'descendant::div[@class="pricing"]/descendant::*[@class="currency"]/@title'
                    )).strip()
                amt = ''.join(
                    item.xpath(
                        'descendant::div[@class="pricing"]/descendant::*[@class="amount"]/text()'
                    )).strip()
                s = SearchResult()
                s.price = (curr + ' ' +
                           amt) if (curr and amt) else _('Not Available')
                title = item.xpath('descendant::h3[@class="item"]')
                if not title: continue
                title = etree.tostring(title[0],
                                       method='text',
                                       encoding=unicode)
                if not title: continue
                s.title = title.strip()
                s.author = ''.join(
                    item.xpath('descendant::li[contains(@class, "author")]/'
                               'a[@class="fn"]/text()')).strip()
                if not s.author: continue
                detail_url = ''.join(
                    item.xpath('descendant::h3[@class="item"]'
                               '/descendant::a[@class="fn" and @href]/@href'))
                if not detail_url: continue
                s.detail_item = detail_url

                counter -= 1

                cover_url = ''.join(
                    item.xpath('descendant::li[@class="coverart"]/'
                               'descendant::img[@src]/@src'))
                if cover_url:
                    if cover_url.startswith('//'):
                        cover_url = 'http:' + cover_url
                    elif cover_url.startswith('/'):
                        cover_url = 'http://ebookstore.sony.com' + cover_url
                    s.cover_url = url_slash_cleaner(cover_url)

                s.drm = SearchResult.DRM_UNKNOWN
                s.formats = 'Sony'

                yield s
示例#6
0
	def _get(self, values, path='/api/do'):
		''' Gets something from the api listener url '''
		self.base_url = prefs['base_url']
		url = url_slash_cleaner(self.base_url + path)
		user_agent = 'Casanova/1.0 (compatible; MSIE 5.5; Windows NT)'
		req = urllib2.Request(url)
		response = urllib2.urlopen(req)
		return response
示例#7
0
 def open(self, parent=None, detail_item=None, external=False):
     url = detail_item or shop_url
     if external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(url)))
     else:
         d = WebStoreDialog(self.gui, shop_url, parent, url)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
 def open(self, parent=None, detail_item=None, external=False):
     url = detail_item or shop_url
     if external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(url)))
     else:
         d = WebStoreDialog(self.gui, shop_url, parent, url)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#9
0
 def open(self, parent=None, detail_item=None, external=False):
     if detail_item:
         if external or self.config.get('open_external', False):
             open_url(QUrl(url_slash_cleaner(detail_item)))
         else:
             d = WebStoreDialog(self.gui, 'http://ebookstore.sony.com', parent, detail_item)
             d.setWindowTitle(self.name)
             d.set_tags(self.config.get('tags', ''))
             d.exec_()
 def open(self, parent=None, detail_item=None, external=False):
     url = 'https://books.google.com/books'
     if True or external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
     else:
         d = WebStoreDialog(self.gui, url, parent, detail_item)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#11
0
    def search(self, query, max_results=10, timeout=60):
        url = "http://ebookstore.sony.com/search?keyword=%s" % urllib.quote_plus(query)

        br = browser()

        counter = max_results
        with closing(br.open(url, timeout=timeout)) as f:
            doc = html.fromstring(f.read())
            for item in doc.xpath(
                '//div[contains(@class, "searchResult")]/' 'descendant::li[contains(@class, "hreview")]'
            ):
                if counter <= 0:
                    break

                curr = "".join(
                    item.xpath('descendant::div[@class="pricing"]/descendant::*[@class="currency"]/@title')
                ).strip()
                amt = "".join(
                    item.xpath('descendant::div[@class="pricing"]/descendant::*[@class="amount"]/text()')
                ).strip()
                s = SearchResult()
                s.price = (curr + " " + amt) if (curr and amt) else _("Not Available")
                title = item.xpath('descendant::h3[@class="item"]')
                if not title:
                    continue
                title = etree.tostring(title[0], method="text", encoding=unicode)
                if not title:
                    continue
                s.title = title.strip()
                s.author = "".join(
                    item.xpath('descendant::li[contains(@class, "author")]/' 'a[@class="fn"]/text()')
                ).strip()
                if not s.author:
                    continue
                detail_url = "".join(
                    item.xpath('descendant::h3[@class="item"]' '/descendant::a[@class="fn" and @href]/@href')
                )
                if not detail_url:
                    continue
                if detail_url.startswith("/"):
                    detail_url = "http:" + detail_url
                s.detail_item = detail_url

                counter -= 1

                cover_url = "".join(item.xpath('descendant::li[@class="coverart"]/' "descendant::img[@src]/@src"))
                if cover_url:
                    if cover_url.startswith("//"):
                        cover_url = "http:" + cover_url
                    elif cover_url.startswith("/"):
                        cover_url = "http://ebookstore.sony.com" + cover_url
                    s.cover_url = url_slash_cleaner(cover_url)

                s.drm = SearchResult.DRM_UNKNOWN
                s.formats = "Sony"

                yield s
示例#12
0
 def open(self, parent=None, detail_item=None, external=False):
     url = 'https://books.google.com/books'
     if external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
     else:
         d = WebStoreDialog(self.gui, url, parent, detail_item)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#13
0
 def open(self, parent=None, detail_item=None, external=False):
     url = 'https://www.bubok.es/tienda'
     if external or self.config.get('open_external', False):
         open_url(
             QUrl(url_slash_cleaner(detail_item if detail_item else url)))
     else:
         d = WebStoreDialog(self.gui, url, parent, detail_item)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec()
示例#14
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://www.bewrite.net/mm5/merchant.mvc?Screen=SFNT'

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
 def open(self, parent=None, detail_item=None, external=False):
     if detail_item:
         if external or self.config.get('open_external', False):
             open_url(QUrl(url_slash_cleaner(detail_item)))
         else:
             d = WebStoreDialog(self.gui, 'http://ebookstore.sony.com',
                                parent, detail_item)
             d.setWindowTitle(self.name)
             d.set_tags(self.config.get('tags', ''))
             d.exec_()
示例#16
0
    def open(self, parent=None, detail_item=None, external=False):
        print("open")
        url = 'http://www.haodoo.net'

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#17
0
    def open(self, parent=None, detail_item=None, external=False):
        google_analytics = '?utm_source=tdcalibre&utm_medium=calibre'
        url = 'http://www.publio.pl/e-booki.html' + google_analytics

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#18
0
    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

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item if detail_item else url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#19
0
    def go_home(self, checked=False, detail_url=None):
        if detail_url:
            url = detail_url
        else:
            url = self.base_url

        # Reduce redundant /'s because some stores
        # (Feedbooks) and server frameworks (cherrypy)
        # choke on them.
        url = url_slash_cleaner(url)
        self.view.load(QUrl(url))
示例#20
0
    def open(self, parent=None, detail_item=None, external=False):
        google_analytics = "?utm_source=tdcalibre&utm_medium=calibre"
        url = "http://www.publio.pl/e-booki.html" + google_analytics

        if external or self.config.get("open_external", False):
            open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get("tags", ""))
            d.exec_()
示例#21
0
    def go_home(self, checked=False, detail_url=None):
        if detail_url:
            url = detail_url
        else:
            url = self.base_url

        # Reduce redundant /'s because some stores
        # (Feedbooks) and server frameworks (cherrypy)
        # choke on them.
        url = url_slash_cleaner(url)
        self.view.load(QUrl(url))
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://www.bewrite.net/mm5/merchant.mvc?Screen=SFNT'

        if external or self.config.get('open_external', False):
            open_url(
                QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#23
0
    def search(self, query, max_results=10, timeout=60):
        url = self.SEARCH_URL % urllib.quote_plus(query)

        br = browser()

        counter = max_results
        with closing(br.open(url, timeout=timeout)) as f:
            doc = html.fromstring(f.read())
            for item in doc.xpath('//div[@id="searchresult-list"]/descendant::div[contains(@class, "doc-item")]'):
                if counter <= 0:
                    break

                s = SearchResult()
                s.price = _('Not Available')
                p = ''.join(item.xpath('descendant::p[@class="doc-price"]/descendant::span[@itemprop="price"]/text()')).strip()
                if p:
                    s.price = 'AUD ' + p.split('$')[-1]

                title = item.xpath('descendant::h3[@class="doc-title"]')
                if not title:
                    continue
                title = etree.tostring(title[0], method='text', encoding=unicode)
                if not title:
                    continue
                st = item.xpath('descendant::p[@class="doc-subtitle"]')
                if st:
                    st = etree.tostring(st[0], method='text', encoding=unicode)
                    if st and st.strip():
                        title = title.strip() + ': ' + st
                s.title = title.strip()
                aut = item.xpath('descendant::p[@class="doc-author"]')
                if not aut:
                    continue
                s.author = etree.tostring(aut[0], method='text', encoding=unicode).strip()
                if not s.author:
                    continue
                du = ''.join(item.xpath('descendant::h3[position() = 1 and @class="doc-title"]/descendant::a[position() = 1 and @href]/@href')).strip()
                if not du:
                    continue
                detail_url = 'https://au.readerstore.sony.com'+du
                s.detail_item = detail_url

                counter -= 1

                cover_url = ''.join(item.xpath(
                    'descendant::p[@class="doc-cover" and position() = 1]/'
                    'descendant::img[position() = 1 and @src]/@src'))
                if cover_url:
                    s.cover_url = url_slash_cleaner(cover_url)

                s.drm = SearchResult.DRM_UNKNOWN
                s.formats = 'Sony'

                yield s
    def open(self, parent=None, detail_item=None, external=False):

        url = 'http://zixo.pl/e_ksiazki/start/'

        if external or self.config.get('open_external', False):
            open_url(
                QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#25
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '12'
        url = 'http://virtualo.pl/ebook/c2/?pr=' + pid
        detail_url = detail_item + '&pr=' + pid if detail_item else url

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#26
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '12'
        url = 'http://virtualo.pl/ebook/c2/?pr=' + pid
        detail_url = detail_item + '&pr=' + pid if detail_item else url

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#27
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '44010'

        url = 'http://www.escapemagazine.pl/s/' + pid

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item + '/s/' + pid if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#28
0
    def open(self, parent=None, detail_item=None, external=False):
        print("open")
        url = 'http://www.haodoo.net'

        if external or self.config.get('open_external', False):
            open_url(
                QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#29
0
	def _post(self, values, path='/api/do'):
		''' Posts something to the casanova listener url '''
		self.base_url = prefs['base_url']
		url = url_slash_cleaner(self.base_url + path)
		user_agent = 'Casanova/1.0 (compatible; MSIE 5.5; Windows NT)'
		values['un'] = prefs['username']
		values['pw'] = prefs['password']
		headers = { 'User-Agent' : user_agent, 'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8' }
		data = urllib.urlencode(values)
		req = urllib2.Request(url, data, headers)
		response = urllib2.urlopen(req)
		return response
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://gutenberg.org/'

        if detail_item:
            detail_item = url_slash_cleaner(url + detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(detail_item if detail_item else url))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#31
0
    def open(self, parent=None, detail_item=None, external=False):
        plain_url = 'http://www.empik.com/ebooki'
        url = 'https://ssl.afiliant.com/affskrypt,,2f9de2,,23c7f,,,?u=(' + plain_url + ')'
        detail_url = None

        if detail_item:
            detail_url = 'https://ssl.afiliant.com/affskrypt,,2f9de2,,23c7f,,,?u=(' + detail_item + ')'

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#32
0
    def open(self, parent=None, detail_item=None, external=False):

        url = 'http://woblink.com/publication'
        detail_url = None

        if detail_item:
            detail_url = 'http://woblink.com' + detail_item

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#33
0
    def open(self, parent=None, detail_item=None, external=False):

        url = "http://www.legimi.com/pl/ebooks/?price=any"
        detail_url = None

        if detail_item:
            detail_url = detail_item

        if external or self.config.get("open_external", False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get("tags", ""))
            d.exec_()
    def open(self, parent=None, detail_item=None, external=False):
        pid = '44010'

        url = 'http://www.escapemagazine.pl/s/' + pid

        if external or self.config.get('open_external', False):
            open_url(
                QUrl(
                    url_slash_cleaner(detail_item + '/s/' +
                                      pid if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#35
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://chitanka.info'

        if external or self.config.get('open_external', False):
            if detail_item:
                url = url + detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            detail_url = None
            if detail_item:
                detail_url = url + detail_item
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#36
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://chitanka.info'

        if external or self.config.get('open_external', False):
            if detail_item:
                url = url + detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            detail_url = None
            if detail_item:
                detail_url = url + detail_item
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#37
0
    def open(self, parent=None, detail_item=None, external=False):

        url = 'http://wolnelektury.pl'
        detail_url = None

        if detail_item:
            detail_url = detail_item

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#38
0
 def _post(self, values, path='/api/do'):
     ''' Posts something to the casanova listener url '''
     self.base_url = prefs['base_url']
     url = url_slash_cleaner(self.base_url + path)
     user_agent = 'Casanova/1.0 (compatible; MSIE 5.5; Windows NT)'
     values['un'] = prefs['username']
     values['pw'] = prefs['password']
     headers = {
         'User-Agent': user_agent,
         'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
     }
     data = urllib.urlencode(values)
     req = urllib2.Request(url, data, headers)
     response = urllib2.urlopen(req)
     return response
示例#39
0
    def open(self, parent=None, detail_item=None, external=False):

        plain_url = "http://www.legimi.com/pl/ebooki/"
        url = "https://ssl.afiliant.com/affskrypt,,2f9de2,,11483,,,?u=(" + plain_url + ")"
        detail_url = None

        if detail_item:
            detail_url = "https://ssl.afiliant.com/affskrypt,,2f9de2,,11483,,,?u=(" + detail_item + ")"

        if external or self.config.get("open_external", False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get("tags", ""))
            d.exec_()
示例#40
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'https://www.millsandboon.co.uk'

        if external or self.config.get('open_external', False):
            if detail_item:
                url = detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            if detail_item:
                detail_url = detail_item
            else:
                detail_url = None
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#41
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'https://www.millsandboon.co.uk'

        if external or self.config.get('open_external', False):
            if detail_item:
                url = detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            if detail_item:
                detail_url = detail_item
            else:
                detail_url = None
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#42
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://www.awin1.com/awclick.php?mid=1414&id=120917'
        detail_url = 'http://www.awin1.com/cread.php?awinmid=1414&awinaffid=120917&clickref=&p='

        if external or self.config.get('open_external', False):
            if detail_item:
                url = detail_url + detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            detail_url = None
            if detail_item:
                detail_url = url + detail_item
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#43
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://www.awin1.com/awclick.php?mid=1150&id=120917'
        detail_url = 'http://www.awin1.com/cread.php?awinmid=1150&awinaffid=120917&clickref=&p='

        if external or self.config.get('open_external', False):
            if detail_item:
                url = detail_url + detail_item
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            detail_url = None
            if detail_item:
                detail_url = url + detail_item
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#44
0
    def open(self, parent=None, detail_item=None, external=False):
        m_url = 'http://www.dpbolvw.net/'
        h_click = 'click-4913808-10364500'
        d_click = 'click-4913808-10281551'

        url = m_url + h_click
        detail_url = None
        if detail_item:
            detail_url = m_url + d_click + detail_item

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#45
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/16/58/'
        url = 'http://woblink.com/publication'

        aff_url = aff_root + str(b64encode(url))
        detail_url = None

        if detail_item:
            detail_url = aff_root + str(b64encode('http://woblink.com' + detail_item))

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
        else:
            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_()
    def open(self, parent=None, detail_item=None, external=False):
        m_url = 'http://www.dpbolvw.net/'
        h_click = 'click-4913808-10364500'
        d_click = 'click-4913808-10281551'

        url = m_url + h_click
        detail_url = None
        if detail_item:
            detail_url = m_url + d_click + detail_item

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#47
0
    def open(self, parent=None, detail_item=None, external=False):

        plain_url = 'http://www.legimi.com/pl/ebooki/'
        url = 'https://ssl.afiliant.com/affskrypt,,2f9de2,,11483,,,?u=(' + plain_url + ')'
        detail_url = None

        if detail_item:
            detail_url = 'https://ssl.afiliant.com/affskrypt,,2f9de2,,11483,,,?u=(' + detail_item + ')'

        if external or self.config.get('open_external', False):
            open_url(QUrl(
                url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#48
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/16/58/'
        url = 'http://woblink.com/publication'

        aff_url = aff_root + str(b64encode(url))
        detail_url = None

        if detail_item:
            detail_url = aff_root + str(b64encode('http://woblink.com' + detail_item))

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
        else:
            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_()
示例#49
0
    def open(self, parent=None, detail_item=None, external=False):

        aff_id = u'?' + _get_affiliate_id()

        url = self.shop_url + aff_id
        detail_url = None
        if detail_item:
            # http://www.litres.ru/pages/biblio_book/?art=157074
            detail_url = self.shop_url + u'/pages/biblio_book/' + aff_id +\
                u'&art=' + urllib2.quote(detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#50
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '5557Y'

        url = 'http://ebookpoint.pl/view/' + pid
        detail_url = None

        if detail_item:
            book_id = re.sub(r'http://ebookpoint.pl/ksiazki', '', detail_item)
            if book_id:
                detail_url = url + book_id

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#51
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/32/58/'

        url = 'http://ebookpoint.pl/'

        aff_url = aff_root + as_base64(url)

        detail_url = None
        if detail_item:
            detail_url = aff_root + as_base64(detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
        else:
            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_()
示例#52
0
    def open(self, parent=None, detail_item=None, external=False):
        pub_id = '0dsO3kDu/AU'
        murl = 'https://click.linksynergy.com/fs-bin/click?id=%s&subid=&offerid=280046.1&type=10&tmpid=9310&RD_PARM1=http%%3A%%2F%%2Fkobo.com' % pub_id

        if detail_item:
            purl = 'https://click.linksynergy.com/link?id=%s&offerid=280046&type=2&murl=%s' % (pub_id, urllib.quote_plus(detail_item))
            url = purl
        else:
            purl = None
            url = murl

        if external or self.config.get('open_external', False):
            open_url(url_slash_cleaner(url))
        else:
            d = WebStoreDialog(self.gui, murl, parent, purl)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#53
0
    def open(self, parent=None, detail_item=None, external=False):
        pub_id = '0dsO3kDu/AU'
        murl = 'http://click.linksynergy.com/fs-bin/click?id=%s&subid=&offerid=280046.1&type=10&tmpid=9310&RD_PARM1=http%%3A%%2F%%2Fkobo.com' % pub_id

        if detail_item:
            purl = 'http://click.linksynergy.com/link?id=%s&offerid=280046&type=2&murl=%s' % (pub_id, urllib.quote_plus(detail_item))
            url = purl
        else:
            purl = None
            url = murl

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            d = WebStoreDialog(self.gui, murl, parent, purl)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#54
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_root = "https://www.a4b-tracking.com/pl/stat-click-text-link/32/58/"

        url = "http://ebookpoint.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_url if detail_url else aff_url)))
        else:
            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_()
示例#55
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/181/58/'

        url = 'https://www.swiatebookow.pl/'

        aff_url = aff_root + as_base64(url)

        detail_url = None
        if detail_item:
            detail_url = aff_root + as_base64(detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else aff_url)))
        else:
            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_()
示例#56
0
    def open(self, parent=None, detail_item=None, external=False):

        aff_id = u'?' + _get_affiliate_id()

        url = self.shop_url + aff_id
        detail_url = None
        if detail_item:
            # http://www.litres.ru/pages/biblio_book/?art=157074
            detail_url = self.shop_url + u'/pages/biblio_book/' + aff_id +\
                u'&art=' + quote(detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#57
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '155711'

        url = 'http://www.nexto.pl/ebooki_c1015.xml'
        detail_url = None

        if detail_item:
            book_id = re.search(r'p[0-9]*\.xml\Z', detail_item)
            book_id = book_id.group(0).replace('.xml','').replace('p','')
            if book_id:
                detail_url = 'http://www.nexto.pl/rf/pr?p=' + book_id + '&pid=' + pid

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#58
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'https://www.smashwords.com/'

        aff_id = '?ref=usernone'
        # Use Kovid's affiliate id 30% of the time.
        if random.randint(1, 10) in (1, 2, 3):
            aff_id = '?ref=kovidgoyal'

        detail_url = None
        if detail_item:
            detail_url = url + detail_item + aff_id
        url = url + aff_id

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#59
0
    def open(self, parent=None, detail_item=None, external=False):
        # Use Kovid's affiliate id 30% of the time
        if random.randint(1, 10) in (1, 2, 3):
            aff_suffix = '&amigosid=23'
        else:
            aff_suffix = '&amigosid=22'
        url = 'http://e-knigi.net/?' + aff_suffix[1:]

        if external or self.config.get('open_external', False):
            if detail_item:
                url = detail_item + aff_suffix
            open_url(QUrl(url_slash_cleaner(url)))
        else:
            detail_url = None
            if detail_item:
                url = detail_item + aff_suffix
            d = WebStoreDialog(self.gui, url, parent, detail_url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()