Automated eBay searching using ebaysearch script

Most people know that eBay is a popular online auction site that also offers fixed price Buy It Now items for sale. If you are a collector, there is no doubt that you will spend quite a bit of time doing eBay searches manually on their website. That method has its benefits, as it allows you to see photos, for example. But if you are searching for rare items that will sell quickly, it would be good to have automatic searching. If I have understood correctly, you can set up automated searches nowadays. But I am not sure how well they behave and there is an alternative.

It is possible to access eBay's online services using your own computer programs. They provide APIs (Application Programming Interfaces) that allow you to search for items and list items as a seller. I think there is even an experimental API for doing automated buying, but I am not sure about this. I myself am a retrogame collector and interested in the 8-bit computer games from the 1980s. My collection is mostly complete, but I am still missing some very rare titles. It was getting very tedious doing the same old searches day after day, finding nothing. Then I thought that maybe the process could be automated by using some kind of a script program on Linux.

I was investigating this topic and found out that eBay offers their official APIs that you can use. I chose Python programming language because I have used that language a little bit before and it had ebaysdk-python package to make programming easier. The situation was better than I had hoped for!

So I figured out how to use the eBay API with ebaysdk and it was very easy indeed. The package is just excellent. I wrote my script ebaysearch using Python 3, the most modern major version of the programming language currently available (as of November 23rd, 2017). The script is fully configurable with a simple JSON configuration file and it uses SQLite databases for keeping track of seen items. I intended ebaysearch to be run periodically using Cron on Linux, FreeBSD, macOS or similar. I guess it will run on Windows too, but I have no interest to test it there.

Obviously this ebaysearch program is most useful when it is running on a computer that is online all the time. If you have access to such a computer, you could use it. But be warned: In order to run the script at all, you have to register as a developer on eBay's Developer site. I do not remember how to do it, but you could start by going to There are three prerequisites for running my ebaysearch program:

  1. Register as "a developer" on eBay Developer Site. Do not be afraid, despite the name, you do not have to be a programmer to join.
  2. After registering, you will obtain your personal AppId. It identifies you to eBay and it is necessary so that ebaysearch program can use the eBay API at all.
  3. Having access to an outgoing email server (SMTP) so that ebaysearch can send you email notifications about newly found items. My ebaysearch program knows how to send email messages using encryption and authentication or without them. It is configurable.

So, your first goal should be to get your own personal AppId, configure ebaysearch to use it and off you go!

You can download ebaysearch-0.4.0.tar.bz2. After unpacking it, please read the README and RELEASE_NOTES files in their entirety. The documentation is not great, but it should get you going if you know what you are doing on Linux, FreeBSD or such.

ebaysearch v0.4.0 (October 30th, 2019)

eBay is ending support for http connections so we switch to https. I actually thought ebaysdk would use https by default, but it was not so.

ebaysearch v0.3.0 (November 11th, 2018)

Feature-wise, v0.3.0 is only a very minor update compared to v0.2.2. It contains mainly Python 3 code cleanups, but it does have one useful addition: Now the notification emails include keywords field so that you no longer have to do annoying guessing to figure out why certain items matched.

This can be good especially when you are setting up new keyword sets and are experimenting. In many cases our keyword sets can match too much, returning irrelevant hits do not interest us. Having access to the keywords field makes life a little bit easier and it should have been included right from the beginning. But I guess better late than never.

ebaysearch v0.2.2

ISO-compliant timedate TEXT field in SQLite urls.db.

In case you want examine urls.db, just open a "connection" to the database from the shell:

sqlite3 /path/to/the/urls.db

And then, for example, you can now do SQL-queries like:

SELECT count(*) FROM urls WHERE date(insert_time) = date('now');

SELECT * FROM urls WHERE date(insert_time) < date('2017-12-14');

DELETE FROM urls WHERE date(insert_time) < date('2017-11-10') AND url LIKE '%ferrari%';