Python tool to extract data from F1 app

Post here all non technical related topics about Formula One. This includes race results, discussions, testing analysis etc. TV coverage and other personal questions should be in Off topic chat.
Xwang
Xwang
33
Joined: Sun Dec 02, 2012 10:12 am

Python tool to extract data from F1 app

Post

Hi to all,
I've found this tool for extracting data from the F1 official app:
https://github.com/KurtMoran/F1-Data-Extractor

Does anyone use it or similar one to get data like speed graphs and so one?
I'm thinking about giving it a try to analyse F1 testing and races.
It seems that the TV access subscription needed but it is only 27€ a year.

PS I do not know how to record the video of the app and if the replay option is available only on the app or also from the web access
I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

User avatar
nzjrs
108
Joined: Wed Jan 07, 2015 10:21 am
Location: Austria

Re: Python tool to extract data from F1 app

Post

I do the same thing, but found it wasn't necessary to train a custom tessaract detector for the F1 font.

Zynerji
Zynerji
105
Joined: Wed Jan 27, 2016 3:14 pm

Re: Python tool to extract data from F1 app

Post

Does the app actually have an API?

User avatar
Oehrly
32
Joined: Mon Jan 08, 2018 4:53 pm

Re: Python tool to extract data from F1 app

Post

Zynerji wrote:
Sun Feb 23, 2020 7:35 pm
Does the app actually have an API?
Pretty sure, but it's not going to be public and certainly not documented.
It probably can be reverse engineered, but I would guess that all requests are encrypted. You should be able to decrypt and read the traffic anyways but the whole project would take quite some time.

User avatar
Oehrly
32
Joined: Mon Jan 08, 2018 4:53 pm

Re: Python tool to extract data from F1 app

Post

OK, did a quick check on my phone

Image

Image

So as I guessed. It has an Api and requests are send over https.
I could only check Events because I don't have an account. But I'm sure it's going to be the same for telemetry.

Zynerji
Zynerji
105
Joined: Wed Jan 27, 2016 3:14 pm

Re: Python tool to extract data from F1 app

Post


User avatar
nzjrs
108
Joined: Wed Jan 07, 2015 10:21 am
Location: Austria

Re: Python tool to extract data from F1 app

Post

Is the telemetry drawn client-side?

Xwang
Xwang
33
Joined: Sun Dec 02, 2012 10:12 am

Re: Python tool to extract data from F1 app

Post

Interesting, but how to use it to save and extract telemetry data?
I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Zynerji
Zynerji
105
Joined: Wed Jan 27, 2016 3:14 pm

Re: Python tool to extract data from F1 app

Post

Not sure yet, but there is an API in there. Might be the bootstrap needed to pull this info directly.

User avatar
Oehrly
32
Joined: Mon Jan 08, 2018 4:53 pm

Re: Python tool to extract data from F1 app

Post

I quickly read through the code. I don't think you can get telemetry with it. Doesn't look like it's implemented. It is called "Minimal API" after all.
If I finally decide on getting an F1 TV subscription and if I have some time, I might take a closer look at it. And maybe I'll try and write a more extensive API wrapper in Python.

User avatar
Juzh
549
Joined: Sat Oct 06, 2012 7:45 am

Re: Python tool to extract data from F1 app

Post

Not too long ago there was a reddit thread where a user was explaining in detail how to scrape all data directly off of websocket, no OCR required, but I think it's only possible for live sessions (don't quote me on that). This way he managed to capture a bunch of data, but crucially I don't think speed traces are included.

For those really interested I suggest reading the entire thread and author's past comments:

https://www.reddit.com/r/formula1/comme ... a_sectors/

Zynerji
Zynerji
105
Joined: Wed Jan 27, 2016 3:14 pm

Re: Python tool to extract data from F1 app

Post

Juzh wrote:
Mon Feb 24, 2020 5:08 pm
Not too long ago there was a reddit thread where a user was explaining in detail how to scrape all data directly off of websocket, no OCR required, but I think it's only possible for live sessions (don't quote me on that). This way he managed to capture a bunch of data, but crucially I don't think speed traces are included.

For those really interested I suggest reading the entire thread and author's past comments:

https://www.reddit.com/r/formula1/comme ... a_sectors/
This API definitely seems more comprehensive... Awesome find!

https://github.com/Ax6/Fast-F1/tree/master/fastf1

User avatar
Oehrly
32
Joined: Mon Jan 08, 2018 4:53 pm

Re: Python tool to extract data from F1 app

Post

So, I'm a bit confused currently. I've seen screenshots like this a few times now
https://i.imgur.com/gTMYIZc.jpg

Which app is that? Do I need F1TV Access/Pro to get that? And is it only available as live data or can you view it after a race? What about testing?

User avatar
Juzh
549
Joined: Sat Oct 06, 2012 7:45 am

Re: Python tool to extract data from F1 app

Post

Oehrly wrote:
Tue Feb 25, 2020 3:49 pm
So, I'm a bit confused currently. I've seen screenshots like this a few times now
https://i.imgur.com/gTMYIZc.jpg

Which app is that? Do I need F1TV Access/Pro to get that? And is it only available as live data or can you view it after a race? What about testing?
You need F1TV access. It's available for all race weekend sessions (fps, quali, race) live and as a replay. It's only available live for testing, no replays.

Xwang
Xwang
33
Joined: Sun Dec 02, 2012 10:12 am

Re: Python tool to extract data from F1 app

Post

Zynerji wrote:
Mon Feb 24, 2020 5:34 pm
Juzh wrote:
Mon Feb 24, 2020 5:08 pm
Not too long ago there was a reddit thread where a user was explaining in detail how to scrape all data directly off of websocket, no OCR required, but I think it's only possible for live sessions (don't quote me on that). This way he managed to capture a bunch of data, but crucially I don't think speed traces are included.

For those really interested I suggest reading the entire thread and author's past comments:

https://www.reddit.com/r/formula1/comme ... a_sectors/
This API definitely seems more comprehensive... Awesome find!

https://github.com/Ax6/Fast-F1/tree/master/fastf1
Using this API, I've managed to do this one

Image

Which is the same as viewtopic.php?p=891389#p891389

The total length is different between the two pilot traces (about 2 meters) so I think the best way to handle that is to normalize the length of the lap to the circuit official length. Do you agree?
Moreover the minimum speed is at different lap position especially in the last turns, but maybe it is a symptom of an early chord point?

Leclerc lap starts at 6 m and ends at 5502.5 m (total lap length 5496.5 m).
Hamilton lap starts at 2.5 m and ends at 5505.5 (total lap length 5503.0 m).
The official track length is 5554 m.

According to you is it possible that on a qualifying lap to have such differences or is it given by telemetry approximation?

On the API documentation page there is the following warning:

Code: Select all

Absolute time is not super accurate. The moment a lap is logged is not always the same and there will be some jitter. At the moment lap time reference is synchronised on the sector time triggered with lowest latency. Expect an error of around ±10m when overlapping telemetry data of different laps.
I do not know if it applies to the above case too.
Last edited by Xwang on Tue Mar 03, 2020 12:32 am, edited 1 time in total.
I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.