• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Hi Guest, The forum software has been updated!
    Please let me know if you spot anything that isn't working as expected.
    I hope you find your way around OK!!!
    Have a great Christmas Guest.
    Best Wishes
    Ark Royal
  • There seems to be a problem with some alerts not being emailed to members. I have told the hosts and they are investigating.
  • Sorry for any problems caused to those that were trying to access the forum earlier today

    There was an authentication issue between the webservers and the database servers we are on!
    Many Thanks to those that emailed me to let tme know of the issue.

    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,
 

ArkRoyal

Administrator
Hi @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?
 

ArkRoyal

Administrator
Hi @hedgehog,

@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