Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

My Ebay Plugin

Place your requests for plugins here

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
he3r0
Posts: 8
Joined: May 23rd, 2006, 4:25 pm

My Ebay Plugin

Post by he3r0 »

maby some plugin for e-bay, for tracking auctions?

tinners
Posts: 16
Joined: January 16th, 2007, 9:29 pm

Re: My Ebay Plugin

Post by tinners »

he3r0 wrote:maby some plugin for e-bay, for tracking auctions?
I know this is an old one, but this could be a good plugin and could work well using the webservices dll and the ebay developer kit.

orbitalstarfish
Plugin Author
Posts: 3
Joined: November 20th, 2006, 4:38 pm

Post by orbitalstarfish »

What sort of information would you be wanting to pull from ebay?

uzumaki
Posts: 13
Joined: May 6th, 2007, 8:29 am

Post by uzumaki »

Something like a list of auctions numbers or title, sorted by starting time or ending time, current amount, and current bidder. Be great for seller to see if anything is selling and buyer could check if he/she is still winning something. May need to use scroll on smaller display but should fit x40 displays and rotate list of auctions across lines. Auction payment reminders? Maybe some other uses as well?

It'd be nice but unless you got to spend a lot of time doing something else and can't be bothered to load My eBay, it may not get much demand.

dajjhman
Posts: 4
Joined: November 27th, 2007, 2:23 am

Almost Done

Post by dajjhman »

it's very easy, i'm working on clearing things up on the matter if is technically a bot...once that is done, i secure the program (as per eBay specs) and it will work
it uses VB to access the eBay API -> there are four (or three, depending on security issues) code portions (1) the LCD Smartie Plugin which will read the (2) text file output of the (3) main app which encrypts and decrypts a config file as per eBay's requests (this way i can keep most of the main app open source : - )... if need be, i may have to use an exe encrypter for the entire thing... (the plugin, however, is guaranteed to be open source, and obviuosly the text file lol)

So far it successfully pulls info from the eBay site (the My eBay feature has to come later after solving authentication issues [each user needs a "token"]) and writes to a text file, readable by a plugin... cant release until a secure the config file and get confirmation that this is NOT a bot... should be soon tho : - )

and yes, this topic is from the grave B - )

dajjhman
Posts: 4
Joined: November 27th, 2007, 2:23 am

Post by dajjhman »

UPDATE: due to various timings in the exchange of the strings, a delay had to be set before reading from the file (once item number has started to be written in the intermediate text file, it is set to wait seven seconds so it can save before opening the connection to eBay, otherwise the file is not ready, and an error occurs).... Also, it has another timer of seven seconds (from the moment it opens the connection) for the file to be altered and saved for LCD Smartie..... if anyone is wiling to post a way around this (i am not very good in making program to dll data transfers, without making them the same program..)

dajjhman
Posts: 4
Joined: November 27th, 2007, 2:23 am

Post by dajjhman »

Ok, eBay recently replied and it turns out I can build the plugin and item checker together, but I have to make it unreadable (since the current version is so slow, i plan to use this but have the segments of source code available, not compiled [certain code cannot be released]).... first, it is suggested that I change my method of calling to a newer and more efficient API call.....should be ready soon...and they said it is not a bot...so far it works great on my LCD, but I have to update that API call and that is personally a pain [since most of my code was based off of the other one] : - P

dajjhman
Posts: 4
Joined: November 27th, 2007, 2:23 am

Post by dajjhman »

ok, I ran into a snag in the code ("[exception: exception has been thrown by the target of an invocation.: object reference not set to an instance of an object.]" appears on the LCD), in order to get rid of needing authentication (not your ebay user and pass, but special tokens that have to be assigned through the code) I had to switch to the shopping api's calls and it made an error which i do not know how to fix (it wasn't the call itself i'm sure, but it's implementation as i used a skeleton of the older api to get started)... here is the code for the initial item lookup (it is the same for the current status, just a different api call)..... my appID and such has been removed, so if you are going to test it you must join the eBay Developers Program... it is made in VB 2005 express... the three functions are as follows, the first pulls the initial information about an auction to the prgram and stores it in a txt file (this information does not change, so it does not have any timing issues) the second function pulls the Changing information such as current price, number of bids, time left etc etc... the third function reads the stored information the does not change from the text file
(load function one, let run then load either or both of the next two)

the code: (the project files (for VB 2005 users) can be downloaded HERE

Code: Select all

Imports System.Net               ' for the HttpWebRequest
Imports System.Text              ' for the character encoding
Imports System.IO                ' for Stream(s)
Imports System.Xml               ' for XmlDocument Processing
'Imports System.Configuration     ' for AppSettings (keys, tokens, etc)
Imports System.Reflection        ' for Embedded XML File
Imports System.Web


'' Retrieve the information for an Auction-Type listed item
'' that is active or has ended within the past 90 days.
Public Class LCDSmartie

    Public Function function1(ByVal param1 As String, ByVal param2 As String) As String

        'checkerror("check_01")

        'Get the Keys from App.Config file
        'Dim devID As String = ConfigurationSettings.AppSettings("DevID")
        Dim appID As String = "************************************"
        ' Dim certID As String = ConfigurationSettings.AppSettings("CertID")

        'Get the Server to use (Sandbox or Production)
        Dim serverUrl As String = "http://open.api.ebay.com/shopping?"

        'Get the User Token to Use
        'Dim userToken As String = ConfigurationSettings.AppSettings("UserToken")

        'SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        'SiteID Indicates the eBay site to associate the call with
        Dim siteID As Integer = 0

        'checkerror("check_02")

        'Item Id - the ID that uniquely identifies an item
        'Console.Write("Enter Item ID: ")
        Dim itemID As String = param1

        'Load the XML Document to Use for this Request
        Dim xmlDoc As XmlDocument = New XmlDocument

        'Get XML Document from Embedded  Resources
        xmlDoc.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("GetSingleItemRequest.xml"))

        'checkerror("check_03")

        'Return "done"

        'Set the various node values
        'xmlDoc("GetItemRequest")("RequesterCredentials")("eBayAuthToken").InnerText = userToken
        xmlDoc("GetSingleItemRequest")("ItemID").InnerText = itemID.ToString()



        'Get XML into a string for use in encoding
        Dim xmlText As String = xmlDoc.InnerXml

        'checkerror("check_04")

        'Return "done"

        'Put the data into a UTF8 encoded  byte array
        Dim encoding As UTF8Encoding = New UTF8Encoding
        Dim dataLen As Integer = encoding.GetByteCount(xmlText)
        Dim utf8Bytes() As Byte = New Byte(dataLen - 1) {}
        encoding.UTF8.GetBytes(xmlText, 0, xmlText.Length, utf8Bytes, 0)

        'Return "done"

        'checkerror("check_05")

        'Create a new HttpWebRequest object for the ServerUrl
        Dim request As HttpWebRequest = CType(WebRequest.Create(serverUrl), HttpWebRequest)

        'Set Request Method (POST) and Content Type (text/xml)
        request.Method = "POST"
        request.ContentType = "text/xml"
        request.ContentLength = utf8Bytes.Length

        'checkerror("check_06")

        'Add the Keys to the HTTP Headers
        'request.Headers.Add("X-EBAY-API-DEV-NAME: " + devID)
        request.Headers.Add("X-EBAY-API-APP-ID: " + appID)
        'request.Headers.Add("X-EBAY-API-CERT-NAME: " + certID)

        'Add Compatability Level to HTTP Headers
        'Regulates versioning of the XML interface for the API
        request.Headers.Add("X-EBAY-API-VERSION: 543")

        'Add function name, SiteID and Detail Level to HTTP Headers
        request.Headers.Add("X-EBAY-API-CALL-NAME: GetSingleItem")
        request.Headers.Add("X-EBAY-API-SITEID: " + siteID.ToString())

        'Time out = 15 seconds,  set to -1 for no timeout.
        'If times-out - throws a WebException with the
        'Status property set to WebExceptionStatus.Timeout.
        request.Timeout = 15000

        'checkerror("check_07")

        Dim str As Stream = Nothing
        Try
            'Set the request Stream
            str = request.GetRequestStream()
            'Write the equest to the Request Steam
            str.Write(utf8Bytes, 0, utf8Bytes.Length)
            str.Close()
            'Get response into stream
            Dim resp As WebResponse = request.GetResponse()
            str = resp.GetResponseStream()
        Catch wEx As WebException
            'Error has occured whilst requesting
            'Display error message and exit.
            If wEx.Status = WebExceptionStatus.Timeout Then
                Console.WriteLine("Request Timed-Out.")
                Return "error_x"
            Else
                Console.WriteLine(wEx.Message)
            End If

            Console.WriteLine("Press Enter to Continue...")
            Console.ReadLine()
            'Return
        End Try


        'checkerror("check_08")

        ' Get Response into String
        Dim sr As StreamReader = New StreamReader(str)
        xmlDoc.LoadXml(sr.ReadToEnd())
        sr.Close()
        str.Close()

        Dim root As XmlNode = xmlDoc("GetSingleItemResponse")
        Dim iteminfo As String

        'There have been Errors
        If Not root("Errors") Is Nothing Then
            Dim errorCode As String = root("Errors")("ErrorCode").InnerText
            Dim errorShort As String = root("Errors")("ShortMessage").InnerText
            Dim errorLong As String = ""
            If Not root("Errors")("LongMessage") Is Nothing Then
                errorLong = root("Errors")("LongMessage").InnerText
            End If

            'Output the error message
            Console.WriteLine(errorCode + " ERROR: " + errorShort)
            Console.WriteLine(errorLong + vbCrLf)
            Return "error"
        Else
        End If

        'checkerror("check_09")

        Dim item As XmlNode
        item = root("item")

        iteminfo = ("title: " + item("title").InnerText) + ("Quantity: " + item("Quantity").InnerText) + item("ListingDetails")("EndTime").InnerText + " GMT;" + " BuyItNow Price: " + item("BuyItNowPrice").InnerText
        Dim objStreamWriter As StreamWriter
        objStreamWriter = New StreamWriter("C:\ebay_LCD_smartie_interface\" + (param1) + ".txt", False)
        objStreamWriter.WriteLine(iteminfo)

        Return "done"

    End Function

Post Reply