...

View Full Version : Regex / GetElementByID Help



mdamon
04-15-2011, 06:52 PM
SOLVED






1) Project Details: (be as specific as possible):

I need some help extracting some information from a dealerships website. Normally I use GetElementById and then RegEx to find a vehicles vin number on a vehicles details page.



var result = document.getElementById('vehicleInformation').parentNode.innerHTML;
var regExp = /[A-Z0-9]{17,17}/g;
result = result.match(regExp);
result = result[0];


But the new site that I have to work with does not have any div id's or tags, only classes. And to make things even harder, the website has vehicles listed with vin numbers hidden in the source code towards the top, so there are many different vin numbers on the page and I can't find a way to get the right one.

Here is a web page that I have to work with.

http://www.fisherkia.net/vehicle-details/2011-kia-sedona-lx-boulder-co-id-780023

I need to reliably get the VIN number of this vehicle in a variable, and I would love it if someone can figure out how to get the year and model in a variable also.

2) Payment Amount:

$20 sent via paypal

Thanks and please let me know if you have any questions
Marc

Fumigator
04-15-2011, 07:05 PM
So you are using Javascript to scrape this webpage? Not a server-side language?

Best thing to do is first find the DIV with the innerHtml value of "VIN #" and then use the next DIV innerHtml value which should be the VIN #. I could code a PHP script to do this pretty easily but I don't know how that fits into your larger picture.

mdamon
04-15-2011, 07:20 PM
So you are using Javascript to scrape this webpage? Not a server-side language?

Best thing to do is first find the DIV with the innerHtml value of "VIN #" and then use the next DIV innerHtml value which should be the VIN #. I could code a PHP script to do this pretty easily but I don't know how that fits into your larger picture.

I have to use Javascript for this, can you do this in JS?

_Aerospace_Eng_
04-16-2011, 01:27 AM
Do you have control of the code on fisherkia.com? If you don't then your javascript won't work either. In which case you would have to use a server side language like php.

Rozetka
04-16-2011, 01:56 AM
just amazing !! xa-xa-xa :)

mdamon
04-16-2011, 04:01 AM
Problem Solved

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum