Moderator: 2020vision
by Ian1506 » Tue Dec 13, 2011 9:45 pm
by Captain Sensible » Wed Dec 14, 2011 7:19 pm
by Ian1506 » Wed Dec 14, 2011 9:05 pm
by Captain Sensible » Wed Dec 14, 2011 9:19 pm
by alrodopial » Wed Dec 14, 2011 11:14 pm
Ian1506 wrote:Thanks Captain.
I believe SPortinglife have these details on their site for each race. I have no idea what a regex is or how to go about scraping. Is ther a template that you know of that I could use as a starting point to learn?
Cheers Ian
by osknows » Thu Dec 15, 2011 12:26 am
Option Explicit
Private Sub GetRPClass()
Dim raceDateString As String, url As String, Racedatetoextract As Date
Dim html As String, meetings As Object, course As String, tempArr() As String
Dim singlemeeting As Object, writerow As Long
'*****MUST set reference MS HTML Object Library*****
Dim tempHTMLDoc As HTMLDocument '*
'*****MUST set reference MS HTML Object Library*****
Racedatetoextract = Date 'Todays Date
raceDateString = Format(Racedatetoextract, "yyyy-mm-dd")
url = "http://www.racingpost.com/horses2/cards/home.sd?r_date=" & raceDateString
html = ExecuteWebRequest(url)
Set tempHTMLDoc = New HTMLDocument
tempHTMLDoc.body.innerHTML = html
Set meetings = tempHTMLDoc.getElementsByTagName("TR")
writerow = 0
For Each singlemeeting In meetings
If InStr(1, singlemeeting.innerText, ":", vbTextCompare) = 0 Then
course = Trim(Replace(Replace(singlemeeting.innerText, "ATR", vbNullString), "RUK", vbNullString))
End If
If InStr(1, singlemeeting.innerText, ":", vbTextCompare) > 0 Then
writerow = writerow + 1
tempArr = Split(singlemeeting.innerText, ":")
If UBound(tempArr) = 1 Then
With Sheet1 '**Change to whatever sheet you need**
.Range("A" & writerow).Value = FindString(singlemeeting.innerText, "[0-9]*:[0-9][0-9]", 0)
.Range("B" & writerow).Value = course
.Range("C" & writerow).Value = singlemeeting.innerText
.Range("D" & writerow).Value = FindString(singlemeeting.innerText, "Cl[1-7]", 0)
End With
End If
End If
Next singlemeeting
End Sub
Public Function ExecuteWebRequest(url As String) As String
Dim oXHTTP As Object
Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
oXHTTP.Open "GET", url, False
oXHTTP.send
ExecuteWebRequest = oXHTTP.responseText
Set oXHTTP = Nothing
End Function
Public Function FindString(ByVal InputString As String, ByVal RegexPattern As String, _
ByVal ReturnArrayElement As Long) As String
On Error GoTo Err:
Dim regex As Object, regexsplit As Object
Set regex = CreateObject("vbscript.regexp")
regex.Ignorecase = True
regex.MultiLine = True
regex.Global = True
regex.Pattern = RegexPattern
Set regexsplit = regex.Execute(InputString)
FindString = regexsplit(ReturnArrayElement)
ExitFunction:
On Error GoTo 0
Exit Function
Err:
FindString = vbNullString
Resume ExitFunction
Resume 'for debugging
End Function
by Ian1506 » Thu Dec 15, 2011 11:10 am
by KevinTHFC » Thu Dec 15, 2011 9:19 pm
With Sheet1 '**Change to whatever sheet you need**
.Range("A" & writerow).Value = FindString(singlemeeting.innerText, "[0-9]*:[0-9][0-9]", 0)
.Range("B" & writerow).Value = course
.Range("C" & writerow).Value = singlemeeting.innerText
.Range("D" & writerow).Value = FindString(singlemeeting.innerText, "Cl[1-7]", 0)
End With
Range("A" & writerow).Value = FindString(singlemeeting.innerText, "[0-9]*:[0-9][0-9]", 0)
Range("B" & writerow).Value = course
Range("C" & writerow).Value = singlemeeting.innerText
Range("D" & writerow).Value = FindString(singlemeeting.innerText, "Cl[1-7]", 0)
by osknows » Thu Dec 15, 2011 10:52 pm
With Sheet1
.Range("A" & writerow).Value =......
.....
end with
by KevinTHFC » Fri Dec 16, 2011 7:51 pm
by Ian1506 » Sat Dec 17, 2011 10:25 am
by osknows » Sat Dec 17, 2011 8:36 pm
by KevinTHFC » Sun Dec 18, 2011 12:12 pm
by Ian1506 » Tue Dec 20, 2011 8:45 am
by Ian1506 » Tue Dec 20, 2011 11:23 am
The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.
Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.
Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.
He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.
We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.