3
2
I'd like to write a script that records the size of the close votes review queue on SO (currently ~95.5k), polling just a few times an hour, so I could plot a general trend. I know what I'm going to do regarding the parsing, i.e. given the following part of the HTTP response,
<div class="dashboard-num" title="95,508">95.5k</div>
I'd apply the regex
<div\s+class="dashboard-num"\s+title="([^"]+)
and split by \D
and implode the array to leave only numbers, or something similar. (Yes, The Pony, He Comes, but this is a quick-and-dirty job during which I don't expect Stack Overflow's HTML to change.)
I don't currently have a UNIX / Linux setup, else I'd throw something together using cron, cURL, and Perl (or sed or awk if I'm feeling brave enough). What's the easiest way to do this on Windows? Is there some utility that's built to do this? I'm willing to install Cygwin and such software if it's indeed the easiest way (say, compared to writing batch scripts), but I'm hoping for some program into which I can supply a URL and regex and be on my way.
note that you can set GETs and recieve the response via Telnet. you can probably do everything you need to in powershell or even a .bat, but personally I'd do it in somthing like .net, python, or java. python install on windows can be a pain, or I'd just suggest it right off. – Frank Thomas – 2013-11-25T19:44:03.423
windows does have vbscript and jscript and powershell. i've done regexes in vbscript. batch files are very primitive, no regexes there. But if you don't know vbscript or jscript or powershell, or even if you do, then it's still totally fine and good to install cygwin or gnuwin32, you can use *nix utilities.. wget, grep, sed e.t.c. I'm a big windows user but still make much use of those utilities from gnuwin32. And if I write a batch file I often use them too. Looking at your title i'd immediately think wget and grep or sed. or wget with perl one liner to do a sed task. – barlop – 2013-11-25T20:03:49.783
I don't know about cron but there is windows task scheduler. – barlop – 2013-11-25T20:08:01.477
@FrankThomas what about installing Python on Windows is a pain? Download the
– MattDMo – 2013-11-25T23:16:02.213.msi
from python.org, run, you're set. If you want extras, go to http://www.lfd.uci.edu/~gohlke/pythonlibs/. What's so hard about that?