public
Description: Scrapes the official golf world ranking and outputs it in a more usable format
Homepage: http://holtsblog.blogspot.com/2008/10/open-source-ogwr-scraper.html
Clone URL: git://github.com/holtonma/ogwr.git
ogwr / README
100644 330 lines (321 sloc) 13.407 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# created by Mark Holton (holtonma@gmail.com)
# copy as much as you want to
# 10-29-2008
# purpose: scrape the official world golf ranking, and present it in a more usable form (TBD: Array of Hashes, maybe)
# using Hpricot, open-uri (later might switch to Nokogiri instead of Hpricot)
 
...Official Golf World Ranking OGWR... code that grabs the official golf world rankings... use the data as you wish in your own application... released as open source...
 
code: http://github.com/holtonma/ogwr/tree/master/ogwr_scraper.rb
test: http://github.com/holtonma/ogwr/tree/master/test_ogwr_scraper.rb
 
enables anyone to take this site...
http://www.officialworldgolfranking.com/rankings/default.sps
 
grab all the data, and do with it what you wish (store to a database each week, hold in your database to related to players on your website, etc). Some boogs, but it's decent for a start:
 
fetcher = Fetcher.new
 
(1..6).each do |page|
  url = "http://www.officialworldgolfranking.com/rankings/default.sps?region=world&PageCount=#{page}"
  players = fetcher.friendly_structure(fetcher.fetch_via_noko(url, page))
  players.each do |p|
    puts "#{p.rank} :: #{p.fname} #{p.lname} #{p.avg_pts} #{p.tot_pts}"
  end
end
 
# example output from the above code!
 1 :: Tiger Woods, 13.79 551.48
 2 :: Sergio Garcia, 8.59 446.55
 3 :: Phil Mickelson, 7.95 389.52
 4 :: Padraig Harrington, 7.51 390.56
 5 :: Vijay Singh, 7.44 409.09
 6 :: Robert Karlsson, 5.27 273.84
 7 :: Camilo Villegas, 5.25 262.35
 8 :: Ernie Els, 5.01 275.76
 9 :: Anthony Kim, 4.84 246.88
 10 :: Lee Westwood, 4.83 256.21
 11 :: Henrik Stenson, 4.78 234.40
 12 :: Jim Furyk, 4.77 238.37
 13 :: Steve Stricker, 4.45 200.03
 14 :: Geoff Ogilvy, 4.36 205.00
 15 :: Stewart Cink, 4.32 211.68
 16 :: K.J. Choi, 4.25 221.18
 17 :: Adam Scott, 4.24 194.96
 18 :: Justin Rose, 4.10 184.34
 19 :: Kenny Perry, 3.90 195.15
 20 :: Miguel A 3.76 195.71
 21 :: Mike Weir, 3.67 187.10
 22 :: Trevor Immelman, 3.60 190.83
 23 :: Justin Leonard, 3.56 192.27
 24 :: Ben Curtis, 3.39 159.45
 25 :: Ian Poulter, 3.39 179.80
 26 :: Martin Kaymer, 3.31 182.04
 27 :: Luke Donald, 3.23 129.02
 28 :: Rory Sabbatini, 3.13 156.37
 29 :: Aaron Baddeley, 3.09 151.40
 30 :: Robert Allenby, 3.08 184.78
 31 :: Andres Romero, 3.03 157.51
 32 :: Stephen Ames, 3.02 141.74
 33 :: Graeme McDowell, 3.01 168.78
 34 :: Ross Fisher, 3.00 162.24
 35 :: Stuart Appleby, 2.97 166.06
 36 :: Shingo Katayama, 2.94 161.62
 37 :: Angel Cabrera, 2.82 143.64
 38 :: Paul Casey, 2.78 138.89
 39 :: Zach Johnson, 2.75 132.13
 40 :: Hunter Mahan, 2.75 151.22
 41 :: Boo Weekley, 2.70 145.62
 42 :: Oliver Wilson, 2.64 145.28
 43 :: Tim Clark, 2.64 126.55
 44 :: Soren Hansen, 2.61 138.50
 45 :: Retief Goosen, 2.60 143.11
 46 :: Jeev Milkha 2.56 189.15
 47 :: Kevin Sutherland, 2.47 126.07
 48 :: Soren Kjeldsen, 2.47 140.88
 49 :: Woody Austin, 2.40 139.20
 50 :: Peter Hanson, 2.39 129.03
 51 :: Sean O'Hair, 2.37 128.14
 52 :: Dudley Hart, 2.34 93.54
 53 :: Scott Verplank, 2.31 110.74
 54 :: Carl Pettersson, 2.26 135.49
 55 :: Brandt Snedeker, 2.20 129.92
 56 :: Chad Campbell, 2.16 120.91
 57 :: Fredrik Jacobson, 2.15 94.51
 58 :: Ryuji Imada, 2.15 126.58
 59 :: Richard Green, 2.14 96.21
 60 :: Brendan Jones, 2.13 93.90
 61 :: Darren Clarke, 2.05 112.79
 62 :: Rocco Mediate, 2.02 98.87
 63 :: Rory McIlroy, 1.97 78.73
 64 :: Charl Schwartzel, 1.97 112.02
 65 :: J.B. Holmes, 1.95 101.48
 66 :: D.J. Trahan, 1.93 112.18
 67 :: Rod Pampling, 1.89 109.57
 68 :: James Kingston, 1.87 103.00
 69 :: Pat Perez, 1.83 98.72
 70 :: Azuma Yano, 1.82 89.40
 71 :: Nick Dougherty, 1.82 98.41
 72 :: Prayad Marksaeng, 1.81 112.50
 73 :: Ken Duke, 1.81 115.86
 74 :: Anders Hansen, 1.80 86.60
 75 :: Jeff Quinney, 1.79 101.75
 76 :: Bart Bryant, 1.78 85.62
 77 :: Davis Love-III, 1.78 78.39
 78 :: Hideto Tanihara, 1.74 88.56
 79 :: Alvaro Quiros, 1.74 74.63
 80 :: Peter Hedblom, 1.71 83.81
 81 :: Billy Mayfair, 1.68 99.37
 82 :: Gonzalo Fdez-Castano, 1.67 86.63
 83 :: Mathew Goggin, 1.66 98.22
 84 :: Nick O'Hern, 1.66 96.26
 85 :: Jerry Kelly, 1.64 98.59
 86 :: Niclas Fasth, 1.64 88.54
 87 :: Heath Slocum, 1.64 93.36
 88 :: Paul Goydos, 1.63 71.55
 89 :: Steve Flesch, 1.62 97.09
 90 :: Hennie Otto, 1.59 63.73
 91 :: Ben Crane, 1.56 62.57
 92 :: Lin Wen-Tang, 1.56 62.49
 93 :: David Toms, 1.56 65.53
 94 :: Paul McGinley, 1.56 81.02
 95 :: Toru Taniguchi, 1.55 83.91
 96 :: Shintaro Kai, 1.54 61.67
 97 :: Peter Lonard, 1.53 94.61
 98 :: Gregory Havret, 1.52 86.73
 99 :: Francesco Molinari, 1.51 81.68
 100 :: John Senden, 1.51 90.54
 101 :: Mark Brown, 1.49 74.70
 102 :: Arron Oberholser, 1.48 59.13
 103 :: Brian Gay, 1.48 93.12
 104 :: Stephen Marino, 1.47 92.42
 105 :: Steve Webster, 1.46 71.74
 106 :: Briny Baird, 1.46 89.24
 107 :: Hiroyuki Fujita, 1.46 67.17
 108 :: Anthony Wall, 1.45 84.38
 109 :: Mark Wilson, 1.45 78.17
 110 :: Bubba Watson, 1.44 79.37
 111 :: Alexander Noren, 1.44 79.35
 112 :: Liang Wen-Chong, 1.44 80.73
 113 :: Alastair Forsyth, 1.43 74.26
 114 :: Charlie Wi, 1.42 83.98
 115 :: Richard Sterne, 1.41 70.62
 116 :: Charles Howell-III, 1.40 81.12
 117 :: Ryo Ishikawa, 1.40 55.92
 118 :: Colin Montgomerie, 1.39 71.11
 119 :: Simon Dyson, 1.38 82.71
 120 :: Louis Oosthuizen, 1.38 68.81
 121 :: Daniel Chopra, 1.37 96.99
 122 :: Gregory Bourdy, 1.36 74.66
 123 :: Kevin Streelman, 1.35 54.05
 124 :: Mark Calcavecchia, 1.34 71.22
 125 :: Pablo Larrazabal, 1.33 62.67
 126 :: Hur Suk-ho, 1.32 59.39
 127 :: David Smail, 1.31 65.49
 128 :: Matt Kuchar, 1.30 70.22
 129 :: Taco Remkes, 1.29 51.60
 130 :: Scott Strange, 1.27 72.34
 131 :: Tommy Armour-III, 1.26 61.64
 132 :: George McNeill, 1.26 74.18
 133 :: Graeme Storm, 1.25 71.24
 134 :: Felipe Aguilar, 1.24 59.62
 135 :: Markus Brier, 1.24 65.67
 136 :: David Horsey, 1.24 49.40
 137 :: Johnson Wagner, 1.23 72.70
 138 :: Matt Bettencourt, 1.23 50.47
 139 :: Jonathan Byrd, 1.23 61.48
 140 :: Toshinori Muto, 1.22 55.98
 141 :: Ryan Moore, 1.21 65.41
 142 :: Richard Finch, 1.20 74.43
 143 :: Robert-Jan Derksen, 1.20 67.18
 144 :: Jyoti Randhawa, 1.20 62.19
 145 :: Dean Wilson, 1.19 71.35
 146 :: Lu Wen-Teh, 1.19 47.44
 147 :: John Rollins, 1.18 67.53
 148 :: Bradley Dredge, 1.18 54.40
 149 :: Thongchai Jaidee, 1.18 66.03
 150 :: Thomas Levet, 1.18 54.21
 151 :: Tomohiro Kondo, 1.18 51.71
 152 :: David Lynn, 1.17 62.12
 153 :: Nicholas Thompson, 1.17 80.81
 154 :: Steve Elkington, 1.16 59.35
 155 :: Dustin Johnson, 1.16 46.46
 156 :: Richie Ramsay, 1.15 45.90
 157 :: Marc Turnesa, 1.15 68.72
 158 :: Mikael Lundberg, 1.14 55.74
 159 :: Tim Herron, 1.14 62.45
 160 :: John Mallinger, 1.13 65.81
 161 :: Lucas Glover, 1.13 61.91
 162 :: John Bickerton, 1.11 55.69
 162 :: John Merrick, 1.11 64.60
 164 :: Lee Dong-hwan, 1.11 53.33
 165 :: David Howell, 1.10 56.01
 166 :: Jason Bohn, 1.09 43.78
 167 :: Paul Lawrie, 1.09 59.09
 168 :: Tom Lehman, 1.09 43.58
 169 :: Thaworn Wiratchant, 1.09 61.92
 170 :: Hidemasa Hoshino, 1.08 45.18
 171 :: Fred Couples, 1.07 42.85
 172 :: Troy Matteson, 1.05 58.98
 173 :: Steve Lowery, 1.04 48.69
 174 :: Thomas Bjorn, 1.03 46.49
 175 :: Nick Watney, 1.03 54.47
 176 :: Peter Lawrie, 1.03 61.53
 177 :: Hiroshi Iwata, 1.02 49.12
 178 :: Damien McGrane, 1.02 63.38
 179 :: Michael Allen, 1.02 51.10
 180 :: Brett Wetterich, 1.02 40.71
 181 :: Tom Pernice-Jr, 1.01 61.72
 182 :: Gary Orr, 1.01 40.47
 183 :: Noh Seung-yul, 1.00 40.19
 184 :: Parker McLachlin, 1.00 55.92
 185 :: Greg Chalmers, 1.00 57.71
 186 :: Brian Davis, 0.99 63.45
 187 :: Katsumasa Miyamoto, 0.99 48.55
 188 :: Mikko Ilonen, 0.99 47.46
 189 :: Steven Conran, 0.99 42.47
 190 :: Michael Campbell, 0.98 49.95
 191 :: Ross McGowan, 0.98 55.80
 192 :: Arjun Atwal, 0.97 56.07
 193 :: Greg Norman, 0.96 38.58
 194 :: Scott Piercy, 0.96 38.39
 195 :: Cliff Kresge, 0.95 55.33
 196 :: Taichi Teshima, 0.95 44.68
 197 :: Nathan Green, 0.95 62.66
 198 :: Chez Reavie, 0.95 54.01
 199 :: Ryan Palmer, 0.94 53.85
 200 :: Raphael Jacquelin, 0.94 51.90
 201 :: Cameron Beckman, 0.94 54.47
 202 :: Gareth Maybin, 0.93 37.31
 203 :: Michael Letzig, 0.93 53.97
 204 :: Spencer Levin, 0.92 38.51
 205 :: Joost Luiten, 0.92 36.60
 206 :: Brett Quigley, 0.91 45.35
 207 :: Bae Sang-moon, 0.91 36.26
 208 :: Brendon de 0.91 53.42
 209 :: Alex Cejka, 0.91 49.77
 210 :: Scott Hend, 0.90 41.52
 211 :: Johan Edfors, 0.90 45.03
 212 :: David Gleeson, 0.90 40.52
 213 :: Robert Dinwiddie, 0.89 50.96
 214 :: Vaughn Taylor, 0.89 53.59
 215 :: Jason Day, 0.89 41.96
 216 :: Estanislao Goya, 0.89 35.48
 217 :: Colt Knost, 0.88 35.24
 218 :: Will Mackenzie, 0.87 45.21
 219 :: Seve Benson, 0.87 34.67
 220 :: Yasuharu Imano, 0.86 39.33
 221 :: Charley Hoffman, 0.85 52.01
 222 :: Kevin Na, 0.85 47.72
 223 :: Chris DiMarco, 0.85 48.51
 224 :: Oliver Fisher, 0.84 48.71
 225 :: Joe Ogilvie, 0.84 50.17
 226 :: Keiichiro Fukabori, 0.83 40.75
 227 :: Bo Van 0.83 51.45
 228 :: Jeff Klauk, 0.82 46.91
 229 :: Greg Kraft, 0.81 39.87
 230 :: Bill Lunde, 0.81 32.45
 231 :: Bill Haas, 0.80 49.00
 232 :: Mark Foster, 0.80 44.00
 233 :: Phillip Archer, 0.80 49.59
 234 :: Ricardo Gonzalez, 0.80 38.32
 235 :: Corey Pavin, 0.80 36.69
 236 :: Andrew McLardy, 0.80 42.20
 237 :: Jose Manuel 0.80 43.78
 238 :: Scott McCarron, 0.79 31.76
 239 :: Craig Parry, 0.79 36.52
 240 :: Jeff Overton, 0.79 45.89
 241 :: Jarrod Lyle, 0.78 47.42
 242 :: Wil Besseling, 0.78 31.02
 243 :: Greg Owen, 0.77 37.96
 244 :: Pelle Edberg, 0.77 44.90
 245 :: Marc Leishman, 0.77 32.49
 246 :: Jamie Donaldson, 0.77 42.45
 247 :: Robert Garrigus, 0.77 43.89
 248 :: Simon Khan, 0.77 39.23
 249 :: Michael Lorenzo-Vera, 0.76 35.07
 250 :: Martin Laird, 0.76 44.21
 251 :: Marc Warren, 0.76 40.38
 252 :: J.J. Henry, 0.76 45.65
 253 :: Chapchai Nirat, 0.76 44.01
 254 :: Magnus A 0.76 41.67
 255 :: Matthew Jones, 0.76 43.19
 256 :: Ignacio Garrido, 0.75 40.71
 257 :: Jean-F Lucquin, 0.75 46.66
 258 :: Brad Adamonis, 0.75 43.64
 259 :: Jay Williamson, 0.75 44.76
 260 :: Kenichi Kuboya, 0.74 34.00
 261 :: Makoto Inoue, 0.73 31.53
 262 :: Koumei Oda, 0.73 34.41
 263 :: Chris Wood, 0.73 29.26
 264 :: Tim Petrovic, 0.73 46.73
 265 :: Brendon Todd, 0.73 29.13
 266 :: Tim Wilkinson, 0.73 41.38
 267 :: Kaname Yokoo, 0.72 35.46
 268 :: Jason Gore, 0.72 44.74
 269 :: David Dixon, 0.72 29.56
 270 :: Rich Beem, 0.72 41.74
 271 :: Bernhard Langer, 0.71 28.59
 272 :: Roland Thatcher, 0.71 30.69
 273 :: Jesper Parnevik, 0.70 40.76
 274 :: D.A. Points, 0.70 40.03
 275 :: Toyokazu Fujishima, 0.70 29.46
 276 :: Jeppe Huldahl, 0.69 30.54
 277 :: Casey Wittenberg, 0.69 27.54
 278 :: Paul Waring, 0.69 27.49
 279 :: Stephen Gallacher, 0.69 36.40
 280 :: David Frost, 0.68 33.23
 281 :: Bob Estes, 0.67 37.77
 282 :: Takao Nogami, 0.67 30.25
 283 :: Joe Durant, 0.67 37.38
 284 :: Michael Jonzon, 0.67 26.66
 285 :: Juvic Pagunsan, 0.67 26.65
 286 :: Kris Blanks, 0.67 27.30
 287 :: John Ellis, 0.66 26.56
 288 :: Klas Eriksson, 0.66 33.04
 289 :: Yusaku Miyazato, 0.66 32.32
 290 :: Charles Warren, 0.66 38.24
 291 :: Brian Bateman, 0.66 26.22
 292 :: Michio Matsumura, 0.65 26.04
 293 :: Daniel Vancsik, 0.65 36.43
 294 :: David Mathis, 0.65 32.45
 295 :: Richard Johnson, 0.65 35.67
 296 :: Maarten Lafeber, 0.65 33.60
 297 :: Ben Leong, 0.64 25.75
 298 :: Steve Allan, 0.64 28.26
 299 :: Shane Bertsch, 0.64 25.67
 300 :: Antti Ahokas, 0.64 30.75
....