pirateofthenet Posted January 11, 2008 Share Posted January 11, 2008 I recently used visual studies 2003 and C# to build a small app to allow me to view my school's web cams on a single page. I wanted to expand the functionality to allow me to view the public traffic cams in Baton Rouge so I set up a new form in the same manner as the one for my school and made a menu to allow the user to select baton rouge or my university. It worked great... for exactly 1 hour because the URL to baton rouge's traffic cams images changes every hour. So what i need is a way to grab the new URL or a way to auto scroll to a pixel so i can just use the web tool but just focus the window on the just image. here's the URL to the public web tool: http://www.dotd.louisiana.gov/press/traffi...p?camera=160021 Quote Link to comment Share on other sites More sharing options...
digip Posted January 11, 2008 Share Posted January 11, 2008 So something like Near Citiplace: http://pub2.camera.trafficland.com/image/l...0405246349922cb College Drive: http://pub2.camera.trafficland.com/image/l...0405246349922cb will change the url every hour? It looks like pubtoken may be a session cookie so maybe that is what changes? I have not looked through all the links yet, but to make a different url every hour seems like there must be a way for them to calculate the method of what the url is going to change to, if in fact that they are even doing this at all. if you look at the url, each camera seems to be in consecutive order where "webid=2030" is just incremented for the next camera. Example in the above two cam links. I do not know if these will load for anyone else if they click on them, because I am not sure if the links are dynamically created for each user per visit, because I do not know if "pubtoken" is created per user. I see that it is just one script tag on each page that calls in the images, so not sure why this would change every hour. Some of the links are not using the same "webid" numbering, so you will need to view the source and find the script that calls it in and then get the image for each one. <html> <head> <META HTTP-EQUIV="refresh" content="16;"> <title>Yes, its ugly tables, but it works</title> </head> <body bgcolor="black"> <table><TR><td style="border-style:solid; border-width:2px; border-color:white;"> <font color="white"> Near Citiplace:<BR> <!-- http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2030 http://pub2.camera.trafficland.com/image/live.jpg?system=ladotd&webid=2030&pubtoken=fca14fed47a5aa8c4edeae33cb36bdef --> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2030"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> College Drive:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2031"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> Acadian:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2032"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> Perkins:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2033"> </td style="border-style:solid; border-width:2px; border-color:white;"></tr><TR><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> Washington:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2034"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> I-110 Split:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2035"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> I-10 @ Nicholson Drive:<BR> <img src="http://pub2.camera.trafficland.com/image/live.jpg?system=dev&webid=2038"> </td style="border-style:solid; border-width:2px; border-color:white;"><td style="border-style:solid; border-width:2px; border-color:white;"><font color="white"> etc...<BR> </td style="border-style:solid; border-width:2px; border-color:white;"></tr></table> </body> </html> I have a widescreen monitor so I can see 4 cams wide, but you may need to change the code I posted above to make them only 2 cam or 3 cam wide. This was just an example of quick page to see if the images would disappear; I will let it run until I see if the images stop loading after the hour like you say. EDIT: It does change after a certain amount of time. Not sure what they are doing to generate the new PUBTOKEN but I am sure it can probably be deduced if not scraped from the site and parsed form the script or their page. EDIT: Do not know if these work all the time, but looks like they have a backup link with NO pubtoken needed to load the images. Maybe this will work all the time: http://pub2.camera.trafficland.com/image/l...&webid=2030 is the format used for the DEV site. Updated the code above to reflect this and will let it run to see how long it goes without changing urls. Quote Link to comment Share on other sites More sharing options...
digip Posted January 11, 2008 Share Posted January 11, 2008 Well, hours later and the DEV link still works with no URL redirection. If you use those links forthe images, then you should be in good shape with your app. I di dnot go through all the images and make them for you, you can figure the rest of them out, but it wasn't too hard to figure out and shoul dbe trivial to do so. Hope it helps. Quote Link to comment Share on other sites More sharing options...
pirateofthenet Posted January 11, 2008 Author Share Posted January 11, 2008 ok that looks like what i need. I'll throw it into my code a little later then post again thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.