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

[francetv] Add fallback video url extraction (closes ytdl-org#22561) #23000

Closed
wants to merge 1 commit into from
Closed

Conversation

gdzx
Copy link
Contributor

@gdzx gdzx commented Nov 6, 2019

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

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:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

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:

$ youtube-dl -f best 'https://www.france.tv/france-2/tout-compte-fait/1919537-une-maison-plus-saine-et-plus-ecolo.html'       
[FranceTVSite] 1919537-une-maison-plus-saine-et-plus-ecolo: Downloading webpage
[FranceTV] 5da51221-d6c7-4de4-ba5b-46a657ad5a32: Downloading video JSON

The new API answers depending on the device_type (maybe some browser values get special treatment, but even ytdl works fine):

curl 'https://player.webservices.francetelevisions.fr/v1/videos/5da51221-d6c7-4de4-ba5b-46a657ad5a32?device_type=desktop&browser=firefox'
{
  "video": {
    "workflow": "token-akamai",
    "token": "https://hdfauthftv-a.akamaihd.net/esi/TA?format=json&url=https%3A%2F%2Fcloudreplayfrancetv.akamaized.net%2F1daedb0b835f5%2F236202674_france-domtom_TA.ism%2Fmanifest.mpd",
    "duration": 2705,
    "embed": false,
    "format": "dash",
    "offline_rights": false,
    "is_live": false,
    "drm": false,
    "drm_type": null,
    "license_type": null,
    "player_verification": false,
    "is_DVR": false,
    "spritesheets": [
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead10.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead11.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead12.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead13.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead14.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead15.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead16.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead17.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead18.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead19.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead110.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead111.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead112.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead113.jpeg",
      "https://staticftv-a.akamaihd.net/videospritesheets/202036/5f538b0bdead1/236202674-5f538b0bdead114.jpeg"
    ],
    "is_startover_enabled": false,
    "coming_next": {
      "timecode": 2695,
      "duration": 8
    },
    "url": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/manifest.mpd",
    "captions": []
  },
  "meta": {
    "id": "5da51221-d6c7-4de4-ba5b-46a657ad5a32",
    "plurimedia_id": "236202674",
    "title": "Tout compte fait",
    "additional_title": "Une maison plus saine et plus écolo",
    "pre_title": null,
    "broadcasted_at": "2020-09-05T14:06:45+02:00",
    "image_url": "https://sivideo.webservices.francetelevisions.fr/staticftv/ref_emissions//2020-09-05/PDM_236202674.jpg"
  },
  "streamroot": {
    "enabled": true,
    "content_id": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/manifest.mpd",
    "property": "replay",
    "license": "6fa93815-2dc9-4df6-9967-3bb108d14bb5"
  },
  "markers": {
    "analytics": {
      "isTrackingEnabled": false
    },
    "estat": {
      "crmID": null,
      "dom": null,
      "level1": "france2",
      "level2": "toutcomptefait",
      "level3": "info",
      "level4": "INTEGRAL",
      "level5": null,
      "serial": "260060207982",
      "streamGenre": "web",
      "streamName": "Tout compte fait-05/09/2020-236202674",
      "streamDuration": 2705,
      "newLevel1": "05/09/2020",
      "newLevel2": "5da51221-d6c7-4de4-ba5b-46a657ad5a32",
      "newLevel3": "francetv",
      "newLevel4": "S00_E00",
      "newLevel5": "Une maison plus saine et plus écolo",
      "newLevel6": "online",
      "newLevel7": null,
      "newLevel8": "magazinedinformation",
      "newLevel9": null,
      "newLevel10": null,
      "newLevel11": null,
      "newLevel12": null,
      "newLevel13": null,
      "newLevel14": null,
      "newLevel15": null,
      "mediaContentId": "236202674",
      "mediaDiffMode": "TVOD",
      "mediaChannel": "825",
      "netMeasurement": null
    },
    "npaw": {
      "customDimension1": null,
      "customDimension2": "web-desktop",
      "customDimension3": "toutcomptefait",
      "customDimension4": "france2",
      "customDimension5": "info",
      "customDimension6": "Intégrale",
      "customDimension7": null,
      "customDimension8": "single"
    },
    "pub": {
      "csid": "www.france.tv",
      "caid": "5da51221-d6c7-4de4-ba5b-46a657ad5a32",
      "afid": "137378050",
      "sfid": "6963749",
      "midroll_timecode": [],
      "isPreview6h": false,
      "mediaTailorUrl": null,
      "pollingInterval": -1
    }
  }
}

On mobile, the manifest is HLS m3u8, whereas on desktop, it is DASH MPD.

Desktop vs mobile diff
4c4
<     "token": "https://hdfauthftv-a.akamaihd.net/esi/TA?format=json&url=https%3A%2F%2Fcloudreplayfrancetv.akamaized.net%2F1daedb0b835f5%2F236202674_france-domtom_TA.ism%2Fmanifest.mpd",
---
>     "token": "https://hdfauthftv-a.akamaihd.net/esi/TA?format=json&url=https%3A%2F%2Fcloudreplayfrancetv.akamaized.net%2F1daedb0b835f5%2F236202674_france-domtom_TA.ism%2Fmaster.m3u8",
7c7
<     "format": "dash",
---
>     "format": "hls",
37c37
<     "url": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/manifest.mpd",
---
>     "url": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/master.m3u8",
51c51
<     "content_id": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/manifest.mpd",
---
>     "content_id": "https://cloudreplayfrancetv.akamaized.net/1daedb0b835f5/236202674_france-domtom_TA.ism/master.m3u8",
93c93
<       "customDimension2": "web-desktop",
---
>       "customDimension2": "web-mobile",

The manifests are both generated by Unified Streaming Platform, and seem to contain the same tracks, with no bitrate or format variations:

manifest.mpd
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Unified Streaming Platform(version=1.8.3) -->
<MPD
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:mpeg:dash:schema:mpd:2011"
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
  xmlns:cenc="urn:mpeg:cenc:2013"
  xmlns:mas="urn:marlin:mas:1-0:services:schemas:mpd"
  type="static"
  mediaPresentationDuration="PT45M5.365333S"
  maxSegmentDuration="PT15S"
  minBufferTime="PT20S"
  profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264">
  <Period
    id="1"
    duration="PT45M5.365333S">
    <BaseURL>dash/</BaseURL>
    <AdaptationSet
      id="1"
      group="1"
      contentType="audio"
      lang="fr"
      segmentAlignment="true"
      audioSamplingRate="48000"
      mimeType="audio/mp4"
      codecs="mp4a.40.2"
      startWithSAP="1">
      <AudioChannelConfiguration
        schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
        value="2">
      </AudioChannelConfiguration>
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <SegmentTemplate
        timescale="48000"
        initialization="236202674_france-domtom_TA-$RepresentationID$.dash"
        media="236202674_france-domtom_TA-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="96256" r="2" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="65536" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="audio_fre=96000"
        bandwidth="96000">
      </Representation>
    </AdaptationSet>
    <AdaptationSet
      id="2"
      group="3"
      contentType="text"
      lang="fr"
      mimeType="application/mp4"
      codecs="stpp"
      startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle" />
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle" />
      <SegmentTemplate
        timescale="1000"
        initialization="236202674_france-domtom_TA-$RepresentationID$.dash"
        media="236202674_france-domtom_TA-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="10000" r="268" />
          <S d="14433" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="textstream_fre=1000"
        bandwidth="1000">
      </Representation>
    </AdaptationSet>
    <AdaptationSet
      id="3"
      group="2"
      contentType="video"
      par="16:9"
      minBandwidth="400000"
      maxBandwidth="2000000"
      maxWidth="1280"
      maxHeight="720"
      segmentAlignment="true"
      sar="1:1"
      frameRate="25"
      mimeType="video/mp4"
      startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <SegmentTemplate
        timescale="25"
        initialization="236202674_france-domtom_TA-$RepresentationID$.dash"
        media="236202674_france-domtom_TA-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="50" r="1351" />
          <S d="33" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="video=400000"
        bandwidth="400000"
        width="384"
        height="216"
        codecs="avc1.42C01E"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=950000"
        bandwidth="950000"
        width="640"
        height="360"
        codecs="avc1.4D401F"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=1400000"
        bandwidth="1400000"
        width="960"
        height="540"
        codecs="avc1.4D401F"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=2000000"
        bandwidth="2000000"
        width="1280"
        height="720"
        codecs="avc1.64001F"
        scanType="progressive">
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>
master.m3u8
#EXTM3U
#EXT-X-VERSION:5
## Created with Unified Streaming Platform(version=1.8.3)
#EXT-X-SESSION-KEY:METHOD=AES-128,URI="https://cloudreplayfrancetv.akamaized.net/keys/crypt.key"

# AUDIO groups
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aacl-96",NAME="Audio Français",LANGUAGE="fr",AUTOSELECT=YES,DEFAULT=YES,CHANNELS="2",URI="236202674_france-domtom_TA-audio_fre=96000.m3u8"

# SUBTITLES groups
#EXT-X-MEDIA:TYPE=SUBTITLES,SUBFORMAT=WebVTT,GROUP-ID="textstream",NAME="Sous-Titres Malentendant",LANGUAGE="fr",AUTOSELECT=YES,DEFAULT=YES,URI="236202674_france-domtom_TA-textstream_fre=1000.m3u8"

# variants
#EXT-X-STREAM-INF:BANDWIDTH=522000,CODECS="mp4a.40.2,avc1.42C01E",RESOLUTION=384x216,FRAME-RATE=25,AUDIO="audio-aacl-96",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
236202674_france-domtom_TA-video=400000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1105000,CODECS="mp4a.40.2,avc1.4D401F",RESOLUTION=640x360,FRAME-RATE=25,AUDIO="audio-aacl-96",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
236202674_france-domtom_TA-video=950000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1582000,CODECS="mp4a.40.2,avc1.4D401F",RESOLUTION=960x540,FRAME-RATE=25,AUDIO="audio-aacl-96",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
236202674_france-domtom_TA-video=1400000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2218000,CODECS="mp4a.40.2,avc1.64001F",RESOLUTION=1280x720,FRAME-RATE=25,AUDIO="audio-aacl-96",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
236202674_france-domtom_TA-video=2000000.m3u8

# keyframes
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=53000,CODECS="avc1.42C01E",RESOLUTION=384x216,URI="keyframes/236202674_france-domtom_TA-video=400000.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=126000,CODECS="avc1.4D401F",RESOLUTION=640x360,URI="keyframes/236202674_france-domtom_TA-video=950000.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=186000,CODECS="avc1.4D401F",RESOLUTION=960x540,URI="keyframes/236202674_france-domtom_TA-video=1400000.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=265000,CODECS="avc1.64001F",RESOLUTION=1280x720,URI="keyframes/236202674_france-domtom_TA-video=2000000.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).

Fallback on another API endpoint when no video formats are found.

Closes #22561
@Fneufneu
Copy link

works fine here !
exemple with url: https://www.france.tv/france-5/simon/simon-saison-2/929389-la-mega-giga-top-surprise.html
before:

# ./youtube-dl https://www.france.tv/france-5/simon/simon-saison-2/929389-la-mega-giga-top-surprise.html
WARNING: Assuming --restrict-filenames since file system encoding cannot encode all characters. Set the LC_ALL environment variable to fix this.
[FranceTVSite] 929389-la-mega-giga-top-surprise: Downloading webpage
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading video JSON
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading geo restriction info
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete o.

with the patch:

# ./youtube-dl https://www.france.tv/france-5/simon/simon-saison-2/929389-la-mega-giga-top-surprise.html
WARNING: Assuming --restrict-filenames since file system encoding cannot encode all characters. Set the LC_ALL environment variable to fix this.
[FranceTVSite] 929389-la-mega-giga-top-surprise: Downloading webpage
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading video JSON
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading geo restriction info
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading fallback video JSON
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading signed hls manifest URL
[FranceTV] 4c1b4457-f91d-4e09-b725-3093f304db60: Downloading m3u8 information
[hlsnative] Downloading m3u8 manifest
WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg
[download] Destination: Simon_-_La_mega_giga_top_surprise-4c1b4457-f91d-4e09-b725-3093f304db60.fhls-880.mp4
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
  configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/share/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic --enable-gpl --enable-avresample --cc=cc --disable-alsa --disable-lii
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[hls @ 0x804f53000] Skip ('#EXT-X-VERSION:5')
[hls @ 0x804f53000] Skip ('## Created with Unified Streaming Platform(version=1.8.3)')
[hls @ 0x804f53000] Skip ('#EXT-X-INDEPENDENT-SEGMENTS')
[hls @ 0x804f53000] Skip ('#USP-X-TIMESTAMP-MAP:MPEGTS=900000,LOCAL=1970-01-01T00:00:00Z')
[hls @ 0x804f53000] Opening 'https://cloudreplayfrancetv.akamaized.net/keys/crypt.key' for reading
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
Input #0, hls, from 'https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5OWFkMmJjYjhhZjg1:
  Duration: 00:05:18.36, start: 10.000000, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to 'file:Simon_-_La_mega_giga_top_surprise-4c1b4457-f91d-4e09-b725-3093f304db60.fhls-880.mp4.part':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
[hls @ 0x804f53000] Opening 'crypto+https://cloudreplayfrancetv.akamaized.net/23e8cc7e5eed5/218723369_france-domtom_TA.ism/ZXhwPTE1Nzc3MjMxNDl+YWNsPSUyZjIzZThjYzdlNWVlZDUlMmYyMTg3MjMzNjlfZnJhbmNlLWRvbXRvbV9UQS5pc20qfmhtYWM9ZmQ5MTUyMDg5Og
frame= 7959 fps=1455 q=-1.0 Lsize=   75605kB time=00:05:18.32 bitrate=1945.7kbits/s speed=58.2x
video:75563kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.054799%
[ffmpeg] Downloaded 77419194 bytes
[download] 100% of 73.83MiB in 00:05
[download] 100% of 73.83MiB in 00:05
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "./youtube-dl/__main__.py", line 19, in <module>
  File "./youtube-dl/youtube_dl/__init__.py", line 469, in main
  File "./youtube-dl/youtube_dl/__init__.py", line 459, in _real_main
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 2018, in download
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 807, in extract_info
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 869, in process_ie_result
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 807, in extract_info
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 862, in process_ie_result
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 1643, in process_video_result
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 1919, in process_info
  File "./youtube-dl/youtube_dl/YoutubeDL.py", line 1864, in dl
  File "./youtube-dl/youtube_dl/downloader/common.py", line 342, in download
  File "/usr/local/lib/python3.6/genericpath.py", line 30, in isfile
    st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe7' in position 100: ordinal not in range(128)

restrict-filenames seems to not be applied
and if i set LC_ALL correctly, everything is fine.

Tested with version 2019.12.25

@06Games
Copy link

06Games commented Feb 13, 2020

I can confirm that this pull request works perfectly!
I tested it on three episodes of Ninjago which until then could not be downloaded and with these changes, I no longer encountered any problems.
The three episodes I'm talking about are:

  • https://www.france.tv/france-3/lego-ninjago/saison-4/248355-l-invitation.html
  • https://www.france.tv/france-3/lego-ninjago/saison-4/253085-un-combat-qui-roule.html
  • https://www.france.tv/france-3/lego-ninjago/1098773-ninjago.html (There are only 2 days left to watch this one)

This pull request should really be merged!

@manikbh
Copy link

manikbh commented Apr 26, 2020

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)

@oilarabla
Copy link

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.

@gdzx
Copy link
Contributor Author

gdzx commented Sep 7, 2020

@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.

@djibux
Copy link

djibux commented Sep 7, 2020

Works like a charm for me.

I was unable to download many Ninjago episodes without this patch.
One example being S02E04, but there are many others (S02E05, S02E06, S02E10, S01E01-04…)

@gdzx
Copy link
Contributor Author

gdzx commented Nov 17, 2020

Closing in favor of #27047.

@gdzx gdzx closed this Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants