Remove affiliate id from Amazon US get books plugin

Amazon have force closed my affiliate account as well, though I never
received any communication from them.
This commit is contained in:
Kovid Goyal 2015-12-12 11:23:25 +05:30
parent 8421468d24
commit e665108b02
2 changed files with 4 additions and 10 deletions

View File

@ -1258,7 +1258,7 @@ class StoreAmazonKindleStore(StoreBase):
headquarters = 'US' headquarters = 'US'
formats = ['KINDLE'] formats = ['KINDLE']
affiliate = True affiliate = False
class StoreSonyStore(StoreBase): class StoreSonyStore(StoreBase):
name = 'SONY Reader Store' name = 'SONY Reader Store'

View File

@ -1,13 +1,12 @@
# -*- 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 = 9 # Needed for dynamic plugin loading store_version = 10 # 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>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import random
from contextlib import closing from contextlib import closing
from lxml import html from lxml import html
@ -218,14 +217,9 @@ class AmazonKindleStore(StorePlugin):
The best (I use the term lightly here) solution is to open Amazon.com The best (I use the term lightly here) solution is to open Amazon.com
in the users default browser and set the affiliate id as part of the url. in the users default browser and set the affiliate id as part of the url.
''' '''
aff_id = {'tag': 'josbl0e-cpb-20'} store_link = 'http://www.amazon.com/Kindle-eBooks'
# Use Kovid's affiliate id 30% of the time.
if random.randint(1, 10) in (1, 2, 3):
aff_id['tag'] = 'calibrebs-20'
store_link = 'http://www.amazon.com/Kindle-eBooks/b/?ie=UTF&node=1286228011&ref_=%(tag)s&ref=%(tag)s&tag=%(tag)s&linkCode=ur2&camp=1789&creative=390957' % aff_id # noqa
if detail_item: if detail_item:
aff_id['asin'] = detail_item store_link = 'http://www.amazon.com/dp/%s' % detail_item
store_link = 'http://www.amazon.com/dp/%(asin)s/?tag=%(tag)s' % aff_id
open_url(QUrl(store_link)) open_url(QUrl(store_link))
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):