I switched to WebClient here instead of WebRequest. It makes things a little easier and I clearly should have been using it all along.
I wrote it in Visual Studio 2013 as a F# script file. I selected all then hit 'alt+enter' to run it.
FsLight was what I was led to when googling F# code formatters. It was easy to use and seems to have done a good job.
1 2 3 4 5 6 7 8 | let webClient = new System.Net.WebClient() let url = "http://www.dilbert.com" let dilbert = webClient.DownloadString(url) let innerUrl = "http://www.dilbert.com/" + System.Text.RegularExpressions.Regex.Match(dilbert, "src=.*strip.gif").Value.Substring(5) innerUrl let innerTempFile = System.IO.Path.GetTempFileName() + ".gif" webClient.DownloadFile(innerUrl, innerTempFile) System.Diagnostics.Process.Start(innerTempFile) |
Created with FsLight
No comments:
Post a Comment