From 1b35d0cbac35c5912cc31150dee4adad0aa446df Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 22 Jun 2019 03:44:51 +0200 Subject: [PATCH] ard_download_button: Return URL of HD m3u. --- video/ard_download_button.user.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/video/ard_download_button.user.js b/video/ard_download_button.user.js index e748081..5f93779 100644 --- a/video/ard_download_button.user.js +++ b/video/ard_download_button.user.js @@ -2,7 +2,7 @@ // @name ARD download button // @description Adds a download-button for every video on ardmediathek.de. // @description:de Fügt einen download-button für jedes video auf ardmediathek.de hinzu. -// @version 2019.06.22.3 +// @version 2019.06.22.4 // @author tastytea // @copyright 2019, tastytea (https://tastytea.de/) // @license GPL-3.0-only @@ -48,13 +48,16 @@ function get_url() // Extract URL from HTML. const re_m3u = new RegExp( // MDR '"(https://[^"]+\.akamaihd\.net/[^"]+master\.m3u8)"'); - for (let re of [re_mp4, re_m3u]) // Try all possible URL formats. + let result = re_mp4.exec(html); + if (result !== null) { - const result = re.exec(html); - if (result !== null) - { - return result[1].replace("/320-", "/1280-"); - } + return result[1].replace("/320-", "/1280-"); + } + + result = re_m3u.exec(html); + if (result !== null) + { + return result[1].replace("/master.m3u8", "/index_3584000_av.m3u8"); } return null;