heliomarpm / udemy-downloader-gui

A desktop application for downloading Udemy Courses
MIT License
1.01k stars 204 forks source link

[Bug] Download crash when response.asset.media_sources contains only auto with m3u8 or/and mpd (is_free=false) #2

Closed ergoz closed 2 years ago

ergoz commented 2 years ago

I found some cources that cannot be downloaded and download process stucks.

After some research i found that some videos are provide asset data with is_free=false and no download links but with encrypted playlists:

{
  "_class": "asset",
  "id": <some_id>,
  "title": ".......mp4",
  "captions": [],
  "body": "",
  "filename": "section-3-.....mp4",
  "media_license_token": "<SOME-MEDIA-LICENSE-TOKEN>",
  "media_sources": [
    {
      "type": "application/x-mpegURL",
      "src": "https://www.udemy.com/assets/<asset-id>/encrypted-files/out/v1/6ab70c733/f85f04620/600594ae6d/index.m3u8?token=<JWT-TOKEN-HERE>&provider=cloudfront&v=1",
      "label": "auto"
    },
    {
      "type": "application/dash+xml",
      "src": "https://www.udemy.com/assets/<asset-id>/encrypted-files/out/v1/6442bafe0733/0b0b4fef/bb87c6/index.mpd?token=<JWT-TOKEN-HERE>&provider=cloudfront&v=1",
      "label": "auto"
    }
  ],
  "download_urls": null,
  "stream_urls": null
}

Some data in this json was truncated for security reasons.

Media sources contains links to encrypted video in playlist.

After processing at https://github.com/heliomarpm/udemy_downloader_gui/blob/master/assets/js/app.js#L529 it will have an incorrect data (no download link).

src: undefined
name: "Awesome Video Name"
quality: -Infinity
type: "Video"
heliomarpm commented 2 years ago

These videos are encrypted with DRM, Udeler is not able to break encryption. In some cases the download gets stuck, unfortunately