Reassembling URLs from Files

As your groups have begun drafting essays for our final product, some of you have asked me how to figure out how to recompose the permalink to a Texas ad using the information in the ad’s txt filename. Here’s a quick tutorial.

First, open your plain text editor (TextWrangler, Notepad, etc.) and paste this into your window:

That’s how every permalink begins. Now copy the filename of the ad you are interested in onto the second line, for example:


Next, delete everything in that line from the last underscore to the beginning of the line, so you are left with this:


Now, use your “find and replace” function to replace all the hyphens (‘-‘) with a forward slash (‘/’), so you get this:


Join your two lines together, and you are pretty close to your URL. The only thing you need to fix is the end. The two final numbers are the lat and lon values, so you need to remove the final forward slash and instead format those numbers like this:

In other words, what comes before the penultimate number is ?zoom=5&lat=, and what comes between the two last numbers (where your final forward slash was) is &lon=. Put it all together and you have your URL!

Comments are closed.