-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[francetv] Add fallback video url extraction (closes ytdl-org#22561) #23000
Conversation
Fallback on another API endpoint when no video formats are found. Closes #22561
works fine here !
with the patch:
restrict-filenames seems to not be applied Tested with version 2019.12.25 |
I can confirm that this pull request works perfectly!
This pull request should really be merged! |
I can confirm this fixes an issue on some videos of france.tv ( https://www.france.tv/france-4/les-as-de-la-jungle-a-la-rescousse/1404197-les-brousse-brothers.html in my case) |
Just noticed this pull request after working on fix, I re-factored quite a bit so I'm not sure whether it would be acceptable but I also added MPD manifests support and used the fallback to retrieve some meta-data. I haven't opened a pull request because this one looks a lot cleaner but I'm leaving my version here in case you want to check it out. |
@oilarabla Nice work! Your version seems fine, maybe you could split the first commit if that bothers the maintainers but otherwise... I also updated my first post with some additional details about the mobile vs desktop manifests. |
Works like a charm for me. I was unable to download many Ninjago episodes without this patch. |
Closing in favor of #27047. |
Please follow the guide below
x
into all the boxes [ ] relevant to your pull request (like that [x])Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Issue
The current extractor for FranceTV relies on the following JSON endpoint to retrieve video URLs https://sivideo.webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/. These URLs are then matched based on their extension. Unfortunately, the associated field in the returned manifest is
null
with results outlined in issue #22561 (and for reasons that would necessitate further investigation).As an example, the following URL exhibits this behavior: https://www.france.tv/france-5/echappees-belles/echappees-belles-saison-13/1066323-l-alsace-de-village-en-village.html.
Fix
In case no video URLs can be retrieved, this commit falls back on the subsequent endpoint https://player.webservices.francetelevisions.fr/v1/videos/. To prevent a 400 status code with an "Origin unknown" message, the following query parameters are mandatory:
device_type
(e.g.mobile
)browser
(e.g.firefox
)Details
Retrieve the video ID from a URL, for instance,
5da51221-d6c7-4de4-ba5b-46a657ad5a32
:The new API answers depending on the
device_type
(maybe somebrowser
values get special treatment, but evenytdl
works fine):curl 'https://player.webservices.francetelevisions.fr/v1/videos/5da51221-d6c7-4de4-ba5b-46a657ad5a32?device_type=desktop&browser=firefox'
On mobile, the manifest is HLS m3u8, whereas on desktop, it is DASH MPD.
Desktop vs mobile diff
The manifests are both generated by Unified Streaming Platform, and seem to contain the same tracks, with no bitrate or format variations:
manifest.mpd
master.m3u8
My implementation relies on the mobile manifest as a fallback, but @oilarabla rewrote the extraction logic #23000 (comment), which might be more appropriate if the API change is permanent.
Need examples!
I have no idea of the scale of this issue, so if you have some examples of non-working videos, please post them below (or even write some script to find them).