asherags / amzsear Goto Github PK
View Code? Open in Web Editor NEWThe unofficial Amazon search CLI & Python API
License: MIT License
The unofficial Amazon search CLI & Python API
License: MIT License
I have installed amzsear 2.0.1 and upgraded pip3 to version 20.2.2. According to Search Amazon Products From Command line - OSTechNix, "you will see the results based on your search string from amazon product directory in your Terminal." and "It will also display the results in your default web browser too." When I run the example amzsear 'Harry Potter Books'
, despite unfathomable error messages syntax error: A “"” can’t go after this identifier
and multiple syntax error: Expected end of line, etc. but found “"”
, I get results in terminal but they are not displayed in Firefox.
Is this no longer supported or are the errors the cause or something else?
I tried your module today in order to get some data from amazon about some products but any way I tried is not returning anything.
❯ amzsear "blundstone" -r DE
Title Prices Rating
❯ amzsear "blundstone" -r UK
Title Prices Rating
❯ amzsear "blundstone" -r UK -i 1
Traceback (most recent call last):
File "/home/dog/Documents/projects/rotar/amazon-api/amazon-venv/bin/amzsear", line 11, in <module>
load_entry_point('amzsear==2.0.1', 'console_scripts', 'amzsear')()
File "/home/dog/Documents/projects/rotar/amazon-api/amazon-venv/lib/python3.8/site-packages/amzsear/cli/cli.py", line 26, in run
prod = out[args['item']]
File "/home/dog/Documents/projects/rotar/amazon-api/amazon-venv/lib/python3.8/site-packages/amzsear/core/AmzSear.py", line 113, in __getitem__
return self.get(key, default=None, raise_error=True)
File "/home/dog/Documents/projects/rotar/amazon-api/amazon-venv/lib/python3.8/site-packages/amzsear/core/AmzSear.py", line 144, in get
raise KeyError('The key %s is not a know index' % (repr(key)) )
KeyError: "The key '1' is not a know index"
Is there any fix, or I am doing something wrong?
For non-US Amazon users, the prices are meaningless. Please enable an option to specify which country should be the default for the query.
I didn't see a product description in the product class. Did you extract product description? How to access it?
Hello,
I have installed amzsear but when i try to search something i get the following error:
Desktop# amzsear 'Harry Potter'
Traceback (most recent call last):
File "/usr/local/bin/amzsear", line 7, in
from amzsear.cli.cli import run
File "/usr/local/lib/python2.7/dist-packages/amzsear/init.py", line 4, in
from .amzsear.core.AmzSear import AmzSear
ImportError: No module named amzsear.core.AmzSear
Can you help me to solve this issue please?
Thank you.
Neal
I think there have been some changes in the structure of the HTML and this no longer works
Hi,
I'm trying to install it on raspberry but I'm obtaining the following issue when run pip install amzsear
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/install.py", line 280, in run
wheel_cache = WheelCache(options.cache_dir, options.format_control)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cache.py", line 293, in __init__
self._ephem_cache = EphemWheelCache(format_control)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cache.py", line 262, in __init__
globally_managed=True,
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/utils/temp_dir.py", line 141, in __init__
path = self._create(kind)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/utils/temp_dir.py", line 189, in _create
tempfile.mkdtemp(prefix="pip-{}-".format(kind))
File "/usr/lib/python2.7/tempfile.py", line 331, in mkdtemp
dir = gettempdir()
File "/usr/lib/python2.7/tempfile.py", line 275, in gettempdir
tempdir = _get_default_tempdir()
File "/usr/lib/python2.7/tempfile.py", line 217, in _get_default_tempdir
("No usable temporary directory found in %s" % dirlist))
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/root']
Can you help me?
amzsear 'Harry Potter' -p 2 -i 35 --output json
Traceback (most recent call last):
File "/home/osboxes/.local/bin/amzsear", line 11, in
sys.exit(run())
File "/home/osboxes/.local/lib/python3.5/site-packages/amzsear/cli/cli.py", line 26, in run
prod = out[args['item']]
File "/home/osboxes/.local/lib/python3.5/site-packages/amzsear/core/AmzSear.py", line 113, in getitem
return self.get(key, default=None, raise_error=True)
File "/home/osboxes/.local/lib/python3.5/site-packages/amzsear/core/AmzSear.py", line 144, in get
raise KeyError('The key %s is not a know index' % (repr(key)) )
KeyError: "The key '35' is not a know index"
I think you have to add cssselector dependency
Traceback (most recent call last):
File "/usr/local/bin/amzsear", line 10, in <module>
sys.exit(run())
File "/usr/local/lib/python3.6/dist-packages/amzsear/cli/cli.py", line 22, in run
out = AmzSear(**amz_args)
File "/usr/local/lib/python3.6/dist-packages/amzsear/core/AmzSear.py", line 84, in __init__
products = html_el.cssselect('li[id*="result_"]')
File "/usr/local/lib/python3.6/dist-packages/lxml/html/__init__.py", line 431, in cssselect
from lxml.cssselect import CSSSelector
File "/usr/local/lib/python3.6/dist-packages/lxml/cssselect.py", line 16, in <module>
'cssselect does not seem to be installed. '
To get correct Kindle ebook prices requires login to the Amazon site. There should be a way to login to the Amazon site and run searches
Issues have been reported in 2019, and it is Nov 1 2019 when I write this:
Has this project been abandoned? We are seeing no responses to the issues being raised.
it would be nice to have a file config (like the standard .config/amzsear/config ) where you can put at least the default region and other options like verbose level.
Traceback (most recent call last):
File "/Users/xxxx/lib/python3.6/site-packages/amzsear/__init__.py", line 2, in <module>
from amzsear.core.AmzSear import AmzSear
File "/Users/xxx/lib/python3.6/site-
packages/amzsear/core/AmzSear.py", line 1, in <module>
from lxml import html as html_module
ModuleNotFoundError: No module named 'lxml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/xxxx/items.py", line 1, in <module>
from amzsear import AmzSear
File "/Users/xxxx/lib/python3.6/site-packages/amzsear/__init__.py", line 4, in <module>
from .amzsear.core.AmzSear import AmzSear
ModuleNotFoundError: No module named 'amzsear.amzsear'
as subject: i tryed to create a aur package, but I discovered that there is also dependency on cssselect module.
$ amzsear 'Harry'
Traceback (most recent call last):
File "/Users/andremachado/Library/Python/2.7/bin/amzsear", line 7, in
from amzsear.cli.cli import run
ImportError: No module named amzsear.cli.cli
$ pip list
Package Version
amzsear 2.0.0
awscli 1.14.32
blockchain 1.4.0
botocore 1.8.36
certifi 2018.4.16
chardet 3.0.4
colorama 0.3.7
docutils 0.14
enum 0.4.6
enum34 1.1.6
futures 3.2.0
idna 2.6
jmespath 0.9.3
pip 18.1
pipenv 2018.11.26
pyasn1 0.4.2
python-dateutil 2.6.1
PyYAML 3.12
requests 2.18.4
rsa 3.4.2
s3transfer 0.1.12
setuptools 40.6.3
six 1.11.0
typing 3.6.6
urllib3 1.22
virtualenv 16.2.0
virtualenv-clone 0.5.0
wheel 0.32.3
I tried:
pip uninstall amzsear
pip install amzsear==2.0.0.0 --user
And does not fix the problem!
Someone can help me?
I tried
:$ amzsear 'car'$ amzsear 'dog'
Title Prices Rating
:
Title Prices Rating
:~$ amzsear 'Harry Potter'
Title Prices Rating
Just show columns' names without any data.
Can anyone tell me why? The Amazon has changed its webpage so we can't get any data anymore?
➜ ~ amzsear 'Harry Potter Books'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 814, in init
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/amzsear", line 11, in
load_entry_point('amzsear==2.0.1', 'console_scripts', 'amzsear')()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/amzsear-2.0.1-py3.6.egg/amzsear/cli/cli.py", line 22, in run
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/amzsear-2.0.1-py3.6.egg/amzsear/core/AmzSear.py", line 78, in init
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/amzsear-2.0.1-py3.6.egg/amzsear/core/AmzSear.py", line 78, in
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
This issue is described here.
The bottom line is that Amazon blocks requests that do not come from a legitimate browser.
In order to combat it, we need to add appropriate headers:
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}
req = urllib.request.Request (someUrl, headers=headers)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.