From 4f23f2514e3b4140610cebfac296eefb4cb8b95f Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 22 Jun 2019 05:11:18 +0200 Subject: [PATCH] ard_download_button: Use submatch. --- video/ard_download_button.user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/video/ard_download_button.user.js b/video/ard_download_button.user.js index f8e08b8..3449715 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.8 +// @version 2019.06.22.9 // @author tastytea // @copyright 2019, tastytea (https://tastytea.de/) // @license GPL-3.0-only @@ -45,10 +45,10 @@ function get_url() // Extract URL from HTML. const html = document.getElementsByTagName('html')[0].innerHTML; const re_mp4 = new RegExp('"(https://[^",]+\.mp4)"', 'g'); - let result = html.match(re_mp4); + let result = [...html.matchAll(re_mp4)]; if (result !== null) - { - return result[result.length - 1].replace(/"/g, ""); + { // Return the last match. + return result[result.length - 1][1]; } return null;