Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2021 API Update #44

Open
4 of 6 tasks
TheDevFreak opened this issue Mar 6, 2021 · 26 comments
Open
4 of 6 tasks

2021 API Update #44

TheDevFreak opened this issue Mar 6, 2021 · 26 comments
Assignees
Labels
enhancement New feature or request

Comments

@TheDevFreak
Copy link
Collaborator

TheDevFreak commented Mar 6, 2021

Investigate the new API.

We need to know:

  • Authentication
  • List Seasons
  • List Events
  • List Sessions
  • List channels of sessions
  • Get M3U8 links.
@TheDevFreak TheDevFreak added the enhancement New feature or request label Mar 6, 2021
@TheDevFreak TheDevFreak self-assigned this Mar 6, 2021
@TheDevFreak TheDevFreak pinned this issue Mar 6, 2021
@robvdpol
Copy link

robvdpol commented Mar 6, 2021

Unfortunately, it seems that the new API doesn't contain any generic functions for retrieving seasons/events/sessions. Or at least, I haven't been able to find them. Instead, the API is now used to retrieve the actual layout of the website.

For example this page:
https://f1tv.formula1.com/page/392/2020-season

Uses the following API call to get the contents of the page:
https://f1tv.formula1.com/2.0/R/ENG/WEB_DASH/ALL/PAGE/392/F1_TV_Pro_Annual/2

This returns a JSON structure with all kinds of headers, titles, subtitles, links that are used to render the page.

Eventually you end up with a contentId that can be used to generate a tokenized stream URL.

@TheDevFreak
Copy link
Collaborator Author

@robvdpol Unfortunately, can confirm..... The closest I got was

https://f1tv.formula1.com/2.0/R/ENG/WEB_DASH/ALL/PAGE/SEARCH/VOD/F1_TV_Pro_Monthly/2?filter_objectSubtype=Meeting&orderBy=meeting_End_Date&sortOrder=asc&filter_season=2021&filter_meetingsUpcoming=Y&filter_orderByFom=Y

Which is by no means perfect because, even with 2021 set, if you set filter_meetingsUpcoming to N it shows every session for 2021; but not pre season testing while when set to Y it does show pre season testing AND all other events (or rather, "Meetings" now)

@TheDevFreak
Copy link
Collaborator Author

Here is all the digging into the API I've achieved so far today.

https://htmlpreview.github.io/?https://gist.githubusercontent.com/TheDevFreak/f70efb05e53884c09e1fb6d11902402c/raw/5bf61d10298ed320b07db7cb492e1d82dfc0d861/yep.html

@robvdpol @leonardoxh and @SoMuchForSubtlety may all find this useful.

@TheDevFreak
Copy link
Collaborator Author

@TheDevFreak One problem i've found, is that their search function only returns the first 100 results from your query, and there's no way to paginate through it or anything like that. So if I asked it to give me all videos (by default it orders alphabetically by title), it will only return 100, and there's no way to request more. I can add a &maxResults=10 option, which will give me the 1st 10, but if I go above 100, it still only returns up to 100.

Yeah, I noticed this too I've not worked out how you're supposed to step past 100; I guess you just don't :/ worth noting the &filter_orderByFom=Y does seem to make it chronological, sort of.

@anthonylavado
Copy link

Someone is doing Python work here: https://github.com/kodosexe/F1Hub

Not sure if it's useful, but I wanted to pass it along.

@waterfietser
Copy link

AppleTV app using new API: https://github.com/NoahFetz/F1AppleTV
I don't have an AppleTV so didn't try, but might be useful as well.

@KenLPham
Copy link

AppleTV app using new API: https://github.com/NoahFetz/F1AppleTV
I don't have an AppleTV so didn't try, but might be useful as well.

https://github.com/NoahFetz/F1AppleTV/blob/5378a0f3e0547a955b8fa1b3799df114cf6e1fe5/F1A-TV/Networking/NetworkRouter.swift#L139

Seems to still be using the old API

@SoMuchForSubtlety
Copy link

It would be interesting to investigate what API the android app uses. I wouldn't be surprised it that still uses the old API.

@TheDevFreak
Copy link
Collaborator Author

It would be interesting to investigate what API the android app uses. I wouldn't be surprised it that still uses the old API.

Yeah, I think that will make it easier - whenever they update the app..... I've not received one yet.

@scottrobertson
Copy link

It would be interesting to investigate what API the android app uses. I wouldn't be surprised it that still uses the old API.

Yeah, I think that will make it easier - whenever they update the app..... I've not received one yet.

It's due in the first half of the season, so don't get too excited ha...

@TheDevFreak
Copy link
Collaborator Author

I've managed to find some better API calls to make tools for the new API.

I've got it all in this mostly proof-of-concept level tool here: https://github.com/TheDevFreak/pyF1Viewer

This may be especially interesting to @SoMuchForSubtlety

@robvdpol
Copy link

I just released an updated version of Race Control with support for the new API, might be interesting to you guys as well. Most of it works, still struggling a bit with the video on demand archive.

https://github.com/robvdpol/RaceControl

@bbsan2k
Copy link
Owner

bbsan2k commented Mar 13, 2021

Thanks everyone for feedback already - it’s really appreciated!!
There are currently 2 different issues we need to be careful not to mix up-

MATRIX Support

Thanks to @joeyberkovitz (#47), the old caching has now been removed an replaced with a more „generic“ approach, which was a major issue with Leia- Matrix Transition. This can be tested with branch Matrix_Support. After some minor adjustments this will probably be part of the release.

New API (2.0)

@TheDevFreak put huge efforts in reverse engineering the new API.
Most certainly we will use the navigation structure that is provided on F1TV main page.
Unfortunately this means, that most of the plug-ins inner working needs to be changed. In the Long Term this will hopefully lead to better maintainability.
Also, the new API and 50FPS etc will only be supported with Matrix, as Leia does not support some special player URLs.
Thanks to everybody involved so far!!!

@doormalena
Copy link

I upgraded to Kodi 19 (Matrix) yesterday and found out the version I had installed 0.1.7 did not work any longer.
I tried if the current version from the Matrix_support branch to see its current status and how I perhaps can contribute with testing.

The plugin is able to start, however directly gives me a account authentication failed error. With debug enabled I don't get any more info revealed. Credentials are working fine in the official F1 app and website. I also tried restoring everything to default settings, it did not make a difference.
Is this a known issue? If I can contribute on testing something please let me know.

@TheDevFreak
Copy link
Collaborator Author

TheDevFreak commented Mar 14, 2021

The Matrix branch is still being built out, hopefully before the start of session 2 of today's testing you will be able to watch it live.

If you install the Matrix_Support version now to your Kodi install you will be able to watch the current live event, being served from the new API (50fps!). There is currently no functionality for anything else (replays, etc)

@doormalena
Copy link

doormalena commented Mar 14, 2021

Awesome! Authentication issue is resolved. I can indeed watch the pre-session live.

It seems to load also quicker then in the previous version. Nice!

@SoMuchForSubtlety
Copy link

By the way I took a look at the android app, and it's still using the old API for everything.

@zzarne
Copy link

zzarne commented Mar 27, 2021

Big thanks to all the contributors for getting this usable in time! 50fps is a huge improvement. So far, what works runs flawlessly.

@RogerKrowiak
Copy link

Is it possible to install this addon on Kodi 18.x? Thank you for our answer.

@bbsan2k
Copy link
Owner

bbsan2k commented Mar 31, 2021

Is it possible to install this addon on Kodi 18.x? Thank you for our answer.

The problem with supporting Leia (18.x) is, that due to the changes in F1TVs API, the player in Leia is not able to correctly parse the live stream m3u8. The addon itself does not have any dependencies for Matrix.

@RogerKrowiak
Copy link

The problem with supporting Leia (18.x) is, that due to the changes in F1TVs API, the player in Leia is not able to correctly parse the live stream m3u8. The addon itself does not have any dependencies for Matrix.

Thank you very much for clarification.

@PostMalone

This comment has been minimized.

@bbsan2k
Copy link
Owner

bbsan2k commented May 2, 2021

Here we go:
Beta release 0.1.99

https://github.com/bbsan2k/plugin.video.f1tv/releases/tag/0.1.99

This should work with the current API and also display Live if possible

Edit: FIxed Live: https://github.com/bbsan2k/plugin.video.f1tv/releases/tag/0.1.100

This was referenced May 2, 2021
@sanderdewit
Copy link

Thank you, it's working well with 0.1.100

@antoinelochet
Copy link

I just tried it with this week-end Grand Prix and it worked beautifully. 1080p@50Hz, no hickups.
Great job !

@magicdude4eva
Copy link

magicdude4eva commented May 23, 2021

Fantastic job - thanks for resolving this 🥇

Is there an updated repo so that updates can be pulled automatically? https://bbsan2k.github.io/repository.f1tv/repo/ does not work on Matrix anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests