skip to Main Content

I would like to implement this :

If the input is “diamond” it needs to search eBay for every variation of the word diamond beginning with d. (Daimond, diaomnd etc) to look for people who have listed things incorrectly.

Like this website: auctionbloopers.com.

I have tried to use api. I am stuck here. I don’t know how I can find all the variations.

My code:

    <script type="text/javascript">
    var ebaySearch_onload = window.onload;
    var ebaySearchCallback = null;
    window.onload = function(a, b, c, d) {
        ebaySearchCallback = function(data) {
            var url = data.findItemsByKeywordsResponse[0].itemSearchURL[0];
            window.location.href = url;
        };

        jQuery(function($) {
            $('#ebaySearchForm').submit(function() {

                $('#ebayLoadingSpinner').html('Loading... Please wait.');

                var url = 'http://svcs.ebay.com/services/search/FindingService/v1'
                    + '?OPERATION-NAME=findItemsByKeywords'
                    + '&SERVICE-VERSION=1.0.0'
                    + '&SECURITY-APPNAME=MYKEY'
                    + '&GLOBAL-ID=EBAY-' + $('#ebayCountrySelect').val()
                    + '&RESPONSE-DATA-FORMAT=JSON'
                    + '&REST-PAYLOAD'
                    + '&callback=ebaySearchCallback'
                    + '&keywords=' + encodeURIComponent($('#ebaySearchInput').val())
                    + '&paginationInput.entriesPerPage=10';

                var script = document.createElement('script');
                script.src = url;
                document.body.appendChild(script);

                return false;
            });
        });

        if('function' == typeof ebaySearch_onload) {
            ebaySearch_onload(a, b, c, d);
        }
    }
    </script>

    <form id="ebaySearchForm" class="form search-form">
            <div class="form-field">
                <label for="ebaySearchInput" style="color: #000;">Search:</label>
                <input id="ebaySearchInput" type="text" maxlength="200" required="required">
                <input type="submit" value="Go">
                <select id="ebayCountrySelect">
                    <option value="US" selected="selected">eBay.com
                    <option value="AT">eBay.at
                    <option value="FRBE">eBay.be
                    <option value="ENCA">eBay.ca
                    <option value="CH">eBay.ch
                    <option value="GB">eBay.uk
                    <option value="AU">eBay.au
                    <option value="DE">eBay.de
                    <option value="ES">eBay.es
                    <option value="FR">eBay.fr
                    <option value="IE">eBay.ie
                    <option value="IT">eBay.it
                    <option value="NL">eBay.nl
                </select>
            </div>
            <div id="ebayLoadingSpinner" style="text-align: center; padding-top: 15px; font-weight: bold; color: #333; padding-right: 120px;"></div>
        </form>

2

Answers


  1. Looking at the code it simply searches Ebay for terms like the word entered and it looks like the developer simply takes the words you searched in their form and manually changes it in several ways such as:

    Example using here is Dean.

    0: Since lower/upper case doesn’t matter make all lowercase

    1: Removing a letter from each position (ean, dan, den, dea)

    2: Switching a letter at each position (edan, daen, dena)

    3: Replacing value n with (n+1) (ddan, deen, deaa)

    4: Adding the value n at (n) (ddean, deean, deaan, deann)

    The developer doesn’t use a client side scripting language like Javascript but more likely PHP or C++ that we cannot see so it is up to you to recreate the code, but it can be easily done in Javascript using variations of “String”.substring();

    Login or Signup to reply.
  2. I don’t think you can use the eBay API to create the permutations for you. Instead, you probably have to calculate those spelling permutations/variations yourself. Then simply send it to the eBay API as usual, such as via a standard findItemsAdvanced call, probably via a long OR string.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search