Skip to content

Instantly share code, notes, and snippets.

@TerryMooreII
Created September 24, 2012 00:34
Show Gist options
  • Save TerryMooreII/3773583 to your computer and use it in GitHub Desktop.
Save TerryMooreII/3773583 to your computer and use it in GitHub Desktop.
Parsing NHL.com for Players information and saving data to CSV file (w/ AUTOIT)
#include <Array.au3>
#include <IE.au3>
#include <File.au3>
$csvFile = "c:\temp\players.csv"
for $i = 1 to 30
$ieObject = _IECreate ("http://www.nhl.com/ice/app?service=page&page=playerstats&fetchKey=20112ALLAASAll&viewName=bios&sort=player.birthCountryAbbrev&pg=" & $i)
$table = _IETableGetCollection ($ieObject, 3)
$aTableData = _IETableWriteToArray ($table, True)
FileOpen($csvFile, 1);
For $r = 1 to UBound($aTableData,1) - 1
For $c = 0 to UBound($aTableData,2) - 1
FileWrite ($csvFile, """" & StringStripWS($aTableData[$r][$c], 3) & """")
if $c = 18 Then
FileWrite ($csvFile, @CRLF)
Else
FileWrite ($csvFile, ",")
EndIf
Next
Next
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment