Extract data from a web site?


#1

I am hoping someone can help me. I have a list of VIN’s for autos and I need to find out the Year, make and model info for them. I found a site “http://www.iseecars.com” that once I enter a VIN like “1GC4KZEG6GF199004” it will give me the info. I am hoping that this could be automated rather than looking up each one.

Here is what I have already: Don’t understand the tagdata parameters

Local theSource
Loop
LoadURL theSource, “http://www.iseecars.com/vin-”+vin

// I think that tagdata would do it but I can’t figure out what to use here

newmake= tagdata(theSource,
newmake= tagdata(theSource,
newmodel= tagdata(theSource,

DownRecord
Until info(“Stopped”)

Any and all help will be appreciated.
Thanks in advance,
Vic


#2

A quick look at the web page source has the info you want in one of the upper lines. As long as the exact format used does not change over time you could use this code to get the data.

Local theSource
Loop
LoadURL theSource, "http://www.iseecars.com/vin-"+vin
theSource=tagdata(theSource,"report for this ","showing price history",1)
newyear=array(theSource,1," ")
newmake=array(theSource,2," ")
newmodel=arrayrange(theSource, 3, arraysize(theSource," "), " ")
DownRecord
Until info("Stopped")

This is with the assumption that the newyear, newmake & newmodel items are fields in your database. The tagdata( function strips out the part of the line containing the string with the year, make and model. From this we extract the first element of this space separated array for the year. Next we get the second element of the array which contains the make info. Lastly we get everything from the third element to the end of the array for the model. This allows us to get the model info even if it contains further spaces.


#3

You might even look up the VIN code and get the elements that you want directly in Panorama, instead of using a web page. That way it is not dependent on the page remaining the same.


#4

Hi Gary,

Thanks. I tried the code and it is not returning anything for me. I put in some text alerts to show the data. The first one - vin show the vin but the second one - the array for the year, make model, show up blank. Any suggestions?
Thanks again,
Vic

Local theSource
Loop
LoadURL theSource, “http://www.iseecars.com/vin-”+vin
Beep alert 1000 "The vin is "+ vin
theSource=tagdata(theSource,"report for this ",“showing price history”,1)
Beep alert 1000 "The array is “+ theSource
stop
newyear=array(theSource,1,” “)
newmake=array(theSource,2,” “)
newmodel=arrayrange(theSource, 3, arraysize(theSource,” "), " ")
DownRecord
Until info(“Stopped”)


#5

Bruce,

Thanks for the tip, but I have no idea how to do that. It would be nice for me if panorama had a VIN decoder built in.

Thanks again,
Vic


#6

The problem seems to be the URL. When I entered http://www.iseecars.com/vin-1GC4KZEG6GF199004 into Safari I got a web page with data for a 2016 Silverado, but if I then copy the URL from the address bar, the address is http://www.iseecars.com/vin-1GC4KZEG6GF199004-c5713. Doing a LoadURL on the first one returns nothing. The second one works. Unless you can figure out where that -c5713 is coming from, it won’t matter what tags you use.


#7

I found another site that works with the VIN and no extras. Response time is pretty slow, but at least it works. The revised procedure, using the new site is

Local theSource
Loop
    LoadURL theSource, "https://www.vindecoderz.com/EN/check-lookup/"+vin
    newyear=tagdata(tagdata(theSource,"Year:</h5></td>","</h5></td>",1),"<strong>","</strong>",1)
    newmake=tagdata(tagdata(theSource,"Brand:</h5></td>","</h5></td>",1),"<strong>","</strong>",1)
    newmodel=tagdata(tagdata(theSource,"Model:</h5></td>","</h5></td>",1),"<strong>","</strong>",1)
    DownRecord
Until info("Stopped")

#8

Here is the exact code I used to test this and it returned the correct info for both the Silverado as well as my vehicle.

Local theSource
LoadURL theSource, "http://www.iseecars.com/vin-"+"1GC4KZEG6GF199004"
theSource=tagdata(theSource,"report for this ","showing price history",1)
message array(theSource,1," ")
message array(theSource,2," ")
message arrayrange(theSource, 3, arraysize(theSource," "), " ")

Now the strange part - I ran the original test in Panorama X and it worked without a problem. The added c5713 extension is not needed nor is it needed if I directly enter the URL into Firefox. I still get the page. However, when I try this in Panorama 6 it does not get the page without using the extension. The LoadURL seems to work differently in Pan 6 than it does in Pan X and returns an empty string in 6.


#9

I found the same thing.

But here’s a different site that works in Panorama 6: https://carlemonsearch.com/decoded.php?vin=1GC4KZEG6GF199004

The relevant data is buried well down in the format:

Make: Chevrolet Model: Silverado 3500hd Trim: LT Crew Cab 4WD Made In: United States Style: Crew Cab Pickup 4-Dr Engine: 6.0L V8 OHV 16V FFV Model Year: 2016

Obviously I’ve re-arranged the data to make it easier to read. Then, this code:

LoadURL theSource, "https://carlemonsearch.com/decoded.php?vin=" + VIN
theSource = TagArray(Text,{"datatd_r">},"</td>",cr())

produces this output:

Chevrolet
Silverado 3500hd
LT Crew Cab 4WD
United States
Crew Cab Pickup 4-Dr
6.0L V8 OHV 16V FFV
2016


#10

Whoops - that HTML code should have read:

<tr><td class="datatd">Make:</td><td class="datatd_r">Chevrolet</td></tr>
<tr><td class="datatd">Model:</td><td class="datatd_r">Silverado 3500hd</td></tr>
<tr><td class="datatd">Trim:</td><td class="datatd_r">LT Crew Cab 4WD</td></tr>
<tr><td class="datatd">Made In:</td><td class="datatd_r">United States</td></tr>
<tr><td class="datatd">Style:</td><td class="datatd_r">Crew Cab Pickup 4-Dr</td></tr>
<tr><td class="datatd">Engine:</td><td class="datatd_r">6.0L V8 OHV 16V FFV</td></tr>
<tr><td class="datatd">Model Year:</td><td class="datatd_r">2016</td></tr>

#11

Thanks Dave, The site & code did indeed work and is pretty slow as you mentioned, but it only let me do 15 and then gives an error. They want to sell an API after that. Looks like $300.00 min per month and for the small number I need now and then not worth it to me.

Thanks again,
Vic


#12

Vic

Did you try this one?


#13

Gary,

Thanks. I tried the code in Panorama X and it is fast and works great. I have Panorama X and can use it for now for this task until the $100.00 I paid runs out. I have used Panorama for several years and have upgraded several time but Pan X is such a change and it would be a big task to convert all the code I use every day. Too bad there isn’t just a one time price upgrade for Pan X. I usually keep Panorama running in the background and pull it up when needed. I create and work on multiply new databases each day. So, thanks to your code I have a solution for now.

Thanks again,
Vic


#14

Michael, I haven’t had a chance to try it yet, but I will. I have to figure out how to code it so that I can get the info out to my fields.

Thanks again,
Vic


#15

Just do this:

LoadURL theSource, "https://carlemonsearch.com/decoded.php?vin=" + VIN
theSource = TagArray(Text,{"datatd_r"&gt;},"&lt;/td&gt;",cr())

Make = array(theSource,1,cr())
Model = array(theSource,2,cr())
Trim = array(theSource,3,cr())
Country of manufacture = array(theSource,4,cr())
Style = array(theSource,5,cr())
Engine = array(theSource,6,cr())
Model year = array(theSource,7,cr())

#16

Sorry, I keep messing up the HTML code. The first two lines of code should be:

LoadURL theSource, "https://carlemonsearch.com/decoded.php?vin=" + VIN
theSource = TagArray(Text,{"datatd_r">},"</td>",cr())

#17

Michael, thanks. I was able to get it to work. I had to change the “theSource = TagArray(Text,{“datatd_r”>},”",cr())" to “theSource = TagArray(theSource,{“datatd_r”>},”",cr())" and then just substitute my field names for the Model =, Make = etc.

Thanks again I really do appreciate all the help you and the others have given me.
Vic