• Hi Guest Just in case you were not aware I wanted to highlight that you can now get a free 7 day trial of Horseracebase here.
    We have a lot of members who are existing users of Horseracebase so help is always available if needed, as well as dedicated section of the fourm here.
    Best Wishes
    AR

Scraping Utility for Those New to Scraping

Never really sure how to best use patternform to predict outcomes... any suggestions on most useful filters to bring the cream to the top would be appreciated :)
 
Hello,

I've written a scraper in visual basic which scrapes the racing post website. I have 2 things I'd like to do..

Have the scraper login to the racing post website so I can get the betting forecast without having to hand key it in. My scraper will get the forecast after 9am but not after 7pm when it is restricted for the next days racing.

I'd like to login and get the topspeed and rpr for the current day but this seems to populate as a 2nd step.

Has anyone solved these problems in visual basic please?

Thanks
 
Hi so is there a up date link that I could use, with up date and a stuped prof of how to get info on it and work it,
I don't racing post subscription,
but I have a HRB subscription,
 
Hi hedgehog hedgehog I don't use the RP site but knew that they restricted access to some parts if you didn't have a subscription.
I am a little confused from your post as to what you can and cannot do.
Does your script successfully log you in to the RP?
 
Hello ArkRoyal ArkRoyal, I can't login using vb as I don't know how, that's the knub of my problem. I can login separately but the scraper doesn't recognise I'm logged in.

Thanks for the help
 
Hi hedgehog hedgehog,

leftinthestalls leftinthestalls provided me with some code to login to the RP in 2008.

I have no idea whether or not it still works, probably not, but may give you some ideas.

Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
ByVal lParam As Long) As Long
Const BM_CLICK = &HF5

Sub RP_Login()
Dim ie As Object
Dim myurl As String
Dim PageForm As HTMLFormElement
Dim UserIdBox As HTMLInputElement
Dim PasswordBox As HTMLInputElement
Dim FormButton As HTMLInputButtonElement
Dim Elem As IHTMLElement
myName = "name"
myPWD = "pwd"
myurl = "https://reg.racingpost.com/modal_dialog/login.sd?"
Set ie = CreateObject("InternetExplorer.Application")
With ie
    .Visible = True
    .navigate "https://reg.racingpost.com/modal_dialog/login.sd?"
   
    Do While ie.readyState <> 4: DoEvents: Loop
    Set PageForm = ie.document.forms(0)
    Set UserIdBox = PageForm.elements("in_un")
    UserIdBox.Value = myName
      
    Set PasswordBox = PageForm.elements("in_pw")
    PasswordBox.Value = myPWD
  
    PageForm.submit
          
    Sleep 500
  
    SendMessage ButtonHwnd, BM_CLICK, 0, 1
      
    myurl = "http://www.racingpost.com"
     
    .Navigate2 myurl
End With
End Sub
 
untested as I don't have a subscription but this may help point you in the right direction

Code:
Sub LoginTest()

  Dim ie As Object
  Dim doc As Object
  Set ie = CreateObject("InternetExplorer.Application")

  ' for debugging only
  ie.Visible = True

  ' go to the login page
  ie.Navigate "https://reg.racingpost.com/mpp/sign_in.sd"

  Do While ie.Busy: DoEvents: Loop
  Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

  Set doc = ie.Document

  ' fill in the login form
  With doc.forms(0)
    .signinEmail.Value = "your email"
    .signinPassword1.Value = "your password"
    .submit
  End With

  Do While ie.Busy: DoEvents: Loop
  Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

  '  hopefully at this point you are now logged in

End Sub
 
Back
Top