Switch to edit mode.
Name(s): _kick1: "Begin generic security check (_kick)"
2: if (verb == "_kick" && !args[1]:isa(this))
3: raise(E_INVARG, "Illegal object", args[1])
4: return E_INVARG
5: endif
6: "End generic security check (_kick)"
7: html = $network:get_url("http://www.nhl.com/onthefly/standings/index.html")
8: if (!html)
9: return
10: endif
11: html = $http_utils:get_body(html)
12: tokens = $html_utils:html2token_suspended(html)
13: tree = $html_utils:token2tree_suspended(tokens, 0)
14: "Now, prune off excess..."
15: pos = {1}
16: while (1)
17: item = $list_utils:tree_branch(tree, pos)
18: if (typeof(item) == $LIST)
19: pos = {@pos, 1}
20: continue
21: elseif (typeof(item) == $STR && pos[$] == 1 && index(item, "TABLE BORDER=0 WIDTH=477"))
22: break
23: endif
24: pos[$] = pos[$] + 1
25: while (pos[$] > length($list_utils:tree_branch(tree, pos[1..$ - 1])))
26: pos = pos[1..$ - 1]
27: pos[$] = pos[$] + 1
28: endwhile
29: endwhile
30: table = $list_utils:tree_branch(tree, pos[1..$ - 1])
31: l = $html_utils:table2list(table)
32: this.east = this.west = {}
33: d = c = ""
34: for x in (l)
35: if (length(x) == 1)
36: if (index(x[1], "CONFERENCE"))
37: e = $string_utils:explode(x[1])
38: c = e[1]
39: d = e[4]
40: elseif (index(x[1], "DIVISION"))
41: d = x[1][1..index(x[1], " ") - 1]
42: endif
43: else
44: if (x[1] != "Team")
45: for i in [2..length(x)]
46: x[i] = toint(x[i])
47: endfor
48: if (c == "EASTERN")
49: this.east = {@this.east, {x[1], d, @x[2..$]}}
50: else
51: this.west = {@this.west, {x[1], d, @x[2..$]}}
52: endif
53: endif
54: endif
55: endfor
56: player:tell("Standings loaded successfully.")
57: this.last_kick_time = time()
58: "Last modified by whiz (#3135) on Sat Mar 18 13:33:04 2006 MST."