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

Site request for plex.tv #4062

Open
7 tasks done
johny1 opened this issue Jun 13, 2022 · 21 comments · May be fixed by #4366
Open
7 tasks done

Site request for plex.tv #4062

johny1 opened this issue Jun 13, 2022 · 21 comments · May be fixed by #4366
Labels
site-request Request to support a new website

Comments

@johny1
Copy link

johny1 commented Jun 13, 2022

Checklist

  • I'm reporting a new site support request
  • I've verified that I'm running yt-dlp version 2022.05.18 (update instructions) or later (specify commit)
  • I've checked that all provided URLs are playable in a browser with the same IP and same login details
  • I've checked that none of provided URLs violate any copyrights or contain any DRM to the best of my knowledge
  • I've searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I've read the guidelines for opening an issue
  • I've read about sharing account credentials and am willing to share it if required

Region

Anywhere

Example URLs

https://watch.plex.tv/movie/borderline

Description

For the example URL, click on 'Watch now' to load the video. It may not play unless if you have adblocker disabled. I've taken the URL and entered it yt-dlp with the following verbose log.

I have also tried grabbing any available stream link with the network tab but could not locate any playlist or master .m3u8 links to use. Thanks.
update: there is a .mpd link that includes a token key but not sure how to use it for yt-dlp

Verbose log

[debug] Command-line config: ['-vU', 'https://watch.plex.tv/movie/borderline']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.05.18 [b14d523] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] Checking exe version: ffprobe -bsfs
[debug] Checking exe version: avprobe -bsfs
[debug] Checking exe version: ffmpeg -bsfs
[debug] exe versions: ffmpeg 4.4.1-essentials_build-www.gyan.dev (setts)
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.10.08, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
Latest version: 2022.05.18, Current version: 2022.05.18
yt-dlp is up to date (2022.05.18)
[debug] [generic] Extracting URL: https://watch.plex.tv/movie/borderline
[generic] borderline: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] borderline: Downloading webpage
[generic] borderline: Extracting information
[debug] Looking for video embeds
[debug] Identified a HTML5 media
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[download] Downloading playlist: Borderline (1980)
[generic] playlist Borderline (1980): Collected 1 videos; downloading 1 of them
[download] Downloading video 1 of 1
[debug] Default format spec: bestvideo*+bestaudio/best
[info] borderline: Downloading 1 format(s): 0
[debug] Invoking http downloader on "https://watch.plex.tv/auto-play-sample.mp4"
[debug] File locking is not supported on this platform. Proceeding without locking
[download] Destination: Borderline (1980) [borderline].mp4
[download] 100% of 1.46KiB in 00:00
[download] Finished downloading playlist: Borderline (1980)
@johny1 johny1 added site-request Request to support a new website triage Untriaged issue labels Jun 13, 2022
@gamer191

This comment was marked as resolved.

@johny1

This comment was marked as outdated.

@october262
Copy link

october262 commented Jun 13, 2022

https://watch.plex.tv/movie/borderline

i was able to grab the MPD using the firefox add-on called the stream detector
however, the movie fails to download because it is DRM protected.

@gamer191
Copy link
Collaborator

gamer191 commented Jun 13, 2022

How to test if an online video is DRM-protected. Please keep in mind that testing one video isn't necessarily an indication of whether all the videos on the website contain drm.

Step 1: start by checking whether the video can be played in your web browser, after disabling DRM technologies on it:

Firefox instructions
  1. visit about:addons

  2. click "Plugins" on the left-hand side

  3. on the right-hand side, click the 3 dots next to "Widevine Content Decryption Module provided by Google Inc." and click "never activate". If you don't see Widevine in that list then it is already disabled.

  4. visit the website and attempt to play the video

  5. If both of the following conditions are met than the video is most likely DRM protected:
    1. the video doesn't play
    2. a message appears at the top of your browser saying that "you must enable DRM to play some audio or video on this page"

Brave Browser instructions
  1. visit brave://settings/?search=widevine and Disable "Widevine"
  2. restart your browser
  3. visit the website and attempt to play the video
  4. If Brave prompts you to install Widevine and the video doesn't play, then the video is most likely DRM protected
Microsoft Edge instructions
  1. change edge://flags/#edge-playready-drm-win10 from default to disabled
  2. change edge://flags/#edge-widevine-drm from default to disabled
  3. restart your browser
  4. if the video doesn't play then the video is most likely DRM protected
  5. repeat steps 1 and 2, this time changing both flags from disabled back to default
Vivaldi instructions
  1. Visit vivaldi://settings and search widevine
  2. Disable Enable widevine plugin
  3. visit the website and attempt to play the video
  4. if the video doesn't play then the video is most likely DRM protected

If the video could be played with DRM disabled, feel free to open a site-support request for the website.
Otherwise, move on to step 2:

if the website has an mobile app available

If a website has an equivalent android app available, it is possible that videos in the app won't be DRM protected. You can check if the videos are DRM protected by installing the app on Bluestacks emulator. If the video plays in Bluestacks, feel free to open a site-support request for that website, but make sure to mention that it works in Bluestacks. However, if the video doesn't play in Bluestacks, then I'm afraid you're out of luck, and the website is very unlikely to be supported by yt-dlp :(

Can I use a different emulator

Sure, but please first make sure it's DRM free. You can do this by installing DRM info on the emulator. If the only DRM technology it shows is "ClearKey CDM", then the emulator is DRM free. Please then report your findings at #4062, so I can update this comment.

If the website doesn't have any mobile apps

Unfortunately, the video is most likely DRM protected. It is unlikely to be supported by yt-dlp. Please do not open any site support requests related to that video.

@october262

This comment was marked as outdated.

@pukkandan

This comment was marked as outdated.

@pukkandan pukkandan closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2022
@pukkandan pukkandan added DRM The referred content is DRM protected and removed triage Untriaged issue labels Jun 13, 2022
@pukkandan

This comment was marked as resolved.

@gamer191

This comment was marked as resolved.

@pukkandan

This comment was marked as resolved.

@mikewesten
Copy link

mikewesten commented Jun 17, 2022

I'm up against similar struggles, looking for solutions and insight about downloading painlessly from plex.tv. After some trial and error I'm able to download from plex.tv successfully some of the time. For the HLS streams, it requires locating two hls/m3u8/token links, one for the video stream and one for the audio stream, downloading each of them (as two mp4 containers), and then combining the two using FFMPEG or similar tools.

I've been looking for ways to eliminate the extra steps and legwork, to simplify the process to where both video and audio streams are downloaded and muxed together concurrently and automatically as is done with most other yt-dlp supported sites. This is the goal.

@pukkandan

This comment was marked as resolved.

@mikewesten
Copy link

After some trial and error I'm able to download from plex.tv successfully some of the time. For the HLS streams, it requires locating two hls/m3u8/token links, one for the video stream and one for the audio stream, downloading each of them (as two mp4 containers), and then combining the two using FFMPEG or similar tools.

Assuming your links don't have DRM, pls provide logs. If it does, take the discussion elsewhere!

Neither the video nor the audio streams are scrambled or unplayable, so probably not. It's just that yt-dlp is not handling plex.tv appropriately, meaning it's not recognizing and downloading both streams concurrently and processing them together into one video file... I end up having to do that myself.

@pukkandan

This comment was marked as resolved.

@pukkandan pukkandan reopened this Jun 25, 2022
@pukkandan pukkandan removed the DRM The referred content is DRM protected label Jun 25, 2022
@pukkandan
Copy link
Member

While the example in OP seems to contain DRM, not all videos do:
Eg: https://watch.plex.tv/movie/bowery-at-midnight

❯ yt-dlp "https://vod.provider.plex.tv/library/parts/6305724320112-hls.m3u8?includeAllStreams=1&X-Plex-Token=xhvsqHDKxR879-C-48Zo"
[generic] 6305724320112-hls: Requesting header
[generic] 6305724320112-hls: Downloading m3u8 information
[info] 6305724320112-hls: Downloading 1 format(s): 2405+audio-3-en__Main_
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 373
[download] Destination: 6305724320112-hls [6305724320112-hls].f2405.mp4
[download]   0.2% of ~893.59MiB at  226.98KiB/s ETA 01:07:04 (frag 0/373)

@HobbyistDev HobbyistDev linked a pull request Jul 17, 2022 that will close this issue
9 tasks
@sethtroisi
Copy link

This was super useful.
Subtitles weren't found but I was able to manually find them by

  1. yt-dlp -j $(URL)
  2. Finding the main en audio group with cat t.txt | jq ".formats[] | {"name": .format_id, "url": .manifest_url}"
  3. Downloading that .m3u8 wget -O test.m3u8 $(AUDIO_URL)
  4. Visually inspecting the m3u8 file head test.m3u8
    #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles-0",NAME="English",DEFAULT=NO,LANGUAGE="en",URI="/library/parts/<ID/subtitles.m3u8?duration=4432&url=https%3A%2F%2Fvod-static.plex.tv%2Fsubtitles%2F<ID>%2Feng.vtt"
  5. Downloading the url-decode &url param https://vod-static.plex.tv/subtitles/<ID>/eng.vtt

@bucanero
Copy link

Here's another example that worked fine, when you use the .m3u8 URL: https://watch.plex.tv/movie/special-when-lit

yt-dlp "https://vod.provider.plex.tv/library/parts/62be16665e5872e9508f50ab-hls.m3u8?includeAllStreams=1&X-Plex-Product=Plex+Mediaverse&X-Plex-Token=yTzrtVtCLAQgDTeZxbvD"

yt-dlp downloaded both video and audio sources and combined them automatically to get a ready-to-watch mp4 video file.

@JasonLandbridge
Copy link

JasonLandbridge commented Jan 6, 2025

Workaround: You can use dash-mpd-cli to download a Plex media by the stream URL which ends in .mpd.

How to get the MPD URL from Plex

  1. Open Plex Web App:

    • Navigate to Plex.tv and log in.
    • Play the media you want to download.
  2. Open the Developer Tools:

    • Right-click anywhere on the page and select Inspect or press Ctrl+Shift+I (Windows/Linux) or Cmd+Opt+I (Mac).
    • Go to the Network tab.
  3. Filter by .mpd:

    • In the search/filter bar, type mpd to narrow the results to MPD files.
  4. Play the Media:

    • Start playing the desired media. Look for a request that ends with .mpd in the network activity.
  5. Copy the MPD URL:

    • Right-click the .mpd request and select Copy > Copy Link Address.

@mylogon341
Copy link

Thanks @JasonLandbridge. I tried this but only get a 401 when trying to use basic auth in the command line for dash-mdp-cli. Would you be able to provide an example command to show what else might be needed for plex. Auth token as well?

@mylogon341
Copy link

Ah. Never mind @JasonLandbridge. I was able to find the full url from Video DownloadHelper plugin in chrome.
Screenshot 2025-01-13 at 8 54 59 am
It actually looks as though you're able to download directly through that plugin with the "CoApp" installed also.

@JasonLandbridge
Copy link

Great! An alternative is PlexRipper (shameless plug as I am the author) that does this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-request Request to support a new website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants