Hi, Habr! In this post, I would like to share with the community my way to automate the tracking of prices of goods on ebay.
What for? To each his own, but I wanted to buy cheaper. So, please under the cat.
1. Retreat
Perhaps I will start with a lyrical digression, if anyone is not interested, then please go straight to step 2.
Once I wanted to change my “Chinese tablet” on an iPad 4. At that time in Belarus, the price for it was $ 600, and on ebay it ranged from a rare $ 300 to $ 450 on average. Plus shipping, plus customs clearance, but this is the tenth case. But there is a problem - cheap lots rarely appear and quickly buy up. So there are 2 exits: either sit and monitor them, or automate this process. Actually, the second way I decided to go. Moreover, the plans for further purchases have already been brewing in my head.
')
2. Design
The mechanism was thought not complicated:
- Go to ebay, configure the search query (check all the necessary parameters in the filter and specify the sorting).
- We create a bot on the site, enter a name, a link with a search query, a target value at which an action will be performed and select an action.
Immediately I wanted to implement this functionality:
- The system can be used by several users.
- Each user can have several bots
- A bot can send an alert by email, SMS
- A bot can bid or purchase from an ebay user account
- Logging of all price changes in the section with the subsequent output on the chart.
Next, the server starts the crowns and the system works 24x7.
3. Toolkit
- PHP framework Yii was chosen.
- For webmordas Javascript jQuery framework
- I did not bother to get bogged down with the ebay API and went impudently into the forehead to parse the pages loaded with CURL using the PHP library PHP Simple HTML DOM Parser
4. Interface
Below are the screenshots of the main pages available for an authorized user.
A page with a list of user bots.
Each bot has a “price meter”, the colder the better the price.
Buttons:
- Switch on switch off
- Switch to ebay section
- Sleeping smiley says that now there are no lucrative offers, when they are, then there will be an alarm clock (click on the switch to a cheap product)
- Bot editing
- View bot information

Bot info page:
- Current advantageous lots.
- Price chart in the section

Bot edit page:

The page with charts prices of active bots:

5. Usage
During use, the following problems were found:
Some sellers add goods to the wrong sections. Basically these are some accessories and parts. There are also clones, like some Chinese clones of iPhones. Therefore, the possibility of bots to shop on their own, I still have not done.
The second problem is unscrupulous sellers, simply scammers. Most often, these are freshly registered users with zero reputation. Sometimes these are “stolen” other people's accounts with a reputation, but without recent activity. Or accounts of sellers who sold for example spare parts for cars, and suddenly began to sell mobile phones.
Before I successfully bought my iPad and Mac Mini, I had 8 refands. 2 of them were from the sellers themselves, and the rest from PayPal (thanks to ebay buyer protection, it works)
Having gained experience, I still bought the desired devices at competitive prices and even taking into account the delivery and customs clearance. The site is still periodically used by a couple of my friends. But the future life of the site, I do not see. I decided to share the project with the community and look forward to further development / evolution of the project.
Link to the working site:
http://selplay.comRegistrations are temporarily disabled because my server will not stand if everyone starts registering and creating bots now. (I hope it will not fall from ordinary visitors)
A link to the repository in bitbucket:
https://bitbucket.org/dvman8bit/yii_ebay_botIn conclusion, I would like to add that I very much look forward to the development of the project or its possible evolution into some useful community project.
And if someone does not mind to treat the author with a beer (-;Z338194344291
R542689573463
410011807856335
PS If someone needs to register, then write to the PM.
UPD : Added installation instructions and dump the database to the repository
UPD2 : Added the ability to register by invite. For an invite, knock on me. I cannot open registration for all of them yet. And the request to get an invite: “Do not throw bots at the site, please. I'm afraid the server won't take it. ”
A small instruction on how to create bots:
1. Open ebay and form a search query. Mark the required properties in the filter. It is advisable to specify the price range.
2. Expose sorting "Price + shipping: lower first"
3. Specify where the delivery
4. Copy link
5. Paste the bot in the desired field
An example of the resulting link