• 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

Scrape racingpost cards with python please help

Can you explain to me how you use your Scripts to scrape the data from the RP.

Welcome to the forum...

Mike.

Yeah, there is a readme on the page I linked to. Are you familiar with github or running python scripts?

Apologies if anyone tried the profile search, I forgot I had to make some changes to the urls in order to directly get the json response, ive fixed it now.
 
Last edited:
ive added a new script, it scrapes the results data for either a country or an individual track, for a specific year or a given range of years

it will be buggy and needs a lot of testing to get get all the errors ironed out so if anyone tries it, would be grateful if errors were reported here or via the issues on github

instructions are in the readme

example of the csv ascot 2018

data1.png
data2.png
 
Last edited:
some updates since last post:

fixed issue with horses pulled up/fallen etc not being recorded, fixed issue with not all races being recorded which was due to a forced 60 second wait after too many requests in short space of time, all races and all runners are now being recorded

added pedigree info and finishing time for all runners based on winning time and bha lengths per second calculation

added interactive shell and simpler commands rather than flags etc, added search feature to find course or region codes, added tab completion for linux
 
4a47 4a47 Hi, been wanting to get my hands on Hong Kong and French Racing data in particular for a while, after reading your earlier post thought it was the answer, i read the instructions and i have been able to extract data for UK and Irish racing , but every time i try to get French or Hong Kong or Dubai it returns an empty csv sheet, do you know if this is something i am doing wrong because my knowledge is limited, or does it not pick up the international races ?
Thanks
Mike
 
It will get whatever races are on the racing post for those countries, which will be limited in most cases outside ireland and uk, but it shouldnt be empty for the 3 you mentioned.

i just tried hong kong 2018 with

hk 2018 flat

and this is the result csv
 
It will get whatever races are on the racing post for those countries, which will be limited in most cases outside ireland and uk, but it shouldnt be empty for the 3 you mentioned.

i just tried hong kong 2018 with

hk 2018 flat

and this is the result csv
Thanks very much for the reply , even more frustrated now because its obviously my fault, but no matter how many times i try still get empty csv file returned.
 
It will get whatever races are on the racing post for those countries, which will be limited in most cases outside ireland and uk, but it shouldnt be empty for the 3 you mentioned.

i just tried hong kong 2018 with

hk 2018 flat

and this is the result csv
There was some information flash up of the black box of the rpscrape,it disappeared very quickly but my son took a video and then a screen shot
at the bottom it says
ValueError: could not convert string to float: '123%'
I haven't a clue it strange that it works for UK racing but returns nothing for me when i try international races
 
So i have been having another go at getting the RP racecards and finally managed to do it,the only problem i have now is how do i tidy up the sheet as it has pulled in all the html with it.
code.PNG
and this is whats returned
 

Attachments

  • link.csv
    561.9 KB · Views: 36
Thanks for your time trying to help me, I made sure I have the latest version and now I cant get any scrape to work at all, obviously my lack of knowledge means I must have failed to do something correctly, no worries , thanks again.
Hi did you get this to work I got it to work but it wont download csv file
 
Back
Top