Squintz
Senior Member
http://www.chart.state.md.us/travinfo/dmsSigns.asp
I am trying to scrape the messages displayed on maryland road signs. So far I have it narrowed down to a bunch of images who have their alpha equilvalent stored in the alt of the HTML. For example...
now after I scrape the site I have a whole crap load of images which I should be able to loop through one at a time and extract the alt value and make a nice little text version of the sign to store in homeseer. Here is an example of the data i want to loop through.
This says "ACCIDENT JERSEY TPKE CLOSED AT EXIT 5 USE ALT I-295 OR I-95"
So I need a loop that will go through and get each alt="VALUE" and store the value into a string. Problem is that if you notice that sometimes the first value is simply a picture and not a alpha/numeric character. I would like to check for this. Also the size of the sign changes so I would need a loop that varies in size.
Here is the page i am trying to scrape:
http://www.chart.state.md.us/travinfo/dmsSigns.asp
EDITED: Second bit of code was not accurate. Updated it so not to confuse anyone.
I am trying to scrape the messages displayed on maryland road signs. So far I have it narrowed down to a bunch of images who have their alpha equilvalent stored in the alt of the HTML. For example...
Code:
<img src="/images/dms/S.gif" alt="S">
now after I scrape the site I have a whole crap load of images which I should be able to loop through one at a time and extract the alt value and make a nice little text version of the sign to store in homeseer. Here is an example of the data i want to loop through.
Code:
<IMG SRC="/images/dms/beacon.gif" ALT="flashing beacon"><BR><img src="/images/dms/A.gif" alt="A"><img src="/images/dms/C.gif" alt="C"><img src="/images/dms/C.gif" alt="C"><img src="/images/dms/I.gif" alt="I"><img src="/images/dms/D.gif" alt="D"><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/N.gif" alt="N"><img src="/images/dms/T.gif" alt="T"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/J.gif" alt="J"><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/R.gif" alt="R"><img src="/images/dms/S.gif" alt="S"><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/Y.gif" alt="Y"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/T.gif" alt="T"><img src="/images/dms/P.gif" alt="P"><img src="/images/dms/K.gif" alt="K"><img src="/images/dms/E.gif" alt="E"><BR><img src="/images/dms/C.gif" alt="C"><img src="/images/dms/L.gif" alt="L"><img src="/images/dms/O.gif" alt="O"><img src="/images/dms/S.gif" alt="S"><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/D.gif" alt="D"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/A.gif" alt="A"><img src="/images/dms/T.gif" alt="T"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/X.gif" alt="X"><img src="/images/dms/I.gif" alt="I"><img src="/images/dms/T.gif" alt="T"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/5.gif" alt="5"><BR><img src="/images/dms/U.gif" alt="U"><img src="/images/dms/S.gif" alt="S"><img src="/images/dms/E.gif" alt="E"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/A.gif" alt="A"><img src="/images/dms/L.gif" alt="L"><img src="/images/dms/T.gif" alt="T"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/I.gif" alt="I"><img src="/images/dms/dash.gif" alt="-"><img src="/images/dms/2.gif" alt="2"><img src="/images/dms/9.gif" alt="9"><img src="/images/dms/5.gif" alt="5"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/O.gif" alt="O"><img src="/images/dms/R.gif" alt="R"><img src="/images/dms/space.gif" alt=" "><img src="/images/dms/I.gif" alt="I"><img src="/images/dms/dash.gif" alt="-"><img src="/images/dms/9.gif" alt="9"><img src="/images/dms/5.gif" alt="5">
This says "ACCIDENT JERSEY TPKE CLOSED AT EXIT 5 USE ALT I-295 OR I-95"
So I need a loop that will go through and get each alt="VALUE" and store the value into a string. Problem is that if you notice that sometimes the first value is simply a picture and not a alpha/numeric character. I would like to check for this. Also the size of the sign changes so I would need a loop that varies in size.
Here is the page i am trying to scrape:
http://www.chart.state.md.us/travinfo/dmsSigns.asp
EDITED: Second bit of code was not accurate. Updated it so not to confuse anyone.