Search code examples
seleniumselenium-chromedriverdrm

How to enable DRM in chromedriver headless mode


I am aware that there is no official support for DRM-protected content (e.g. Spotify webplayer, netflix, etc.) when using headless chromedriver.

Has anyone here gotten it to work despite the aforementioned limitation?

I went as far as using a custom profile in headless chromedriver (one that should include WidevineCdm), but so far no luck.


Solution

  • Solution: replacing Chromiuim's default libwidevine binary with one extracted from ChromeOS.

    1. Download the latest ChromeOS libwidevine binary and extract it.

    2. Copy the extracted libwidevinecdm.so to /usr/lib/chromium-browser.

    3. Change the access permissions to 755 (chmod 755 libwidevinecdm.so)

    Credits to vpetkovs's blog post for finding this bright solution.