forked from tastytea/userscripts
ard_download_button: Use submatch.
This commit is contained in:
parent
2f1f7d718e
commit
4f23f2514e
|
@ -2,7 +2,7 @@
|
||||||
// @name ARD download button
|
// @name ARD download button
|
||||||
// @description Adds a download-button for every video on ardmediathek.de.
|
// @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.
|
// @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
|
// @author tastytea
|
||||||
// @copyright 2019, tastytea (https://tastytea.de/)
|
// @copyright 2019, tastytea (https://tastytea.de/)
|
||||||
// @license GPL-3.0-only
|
// @license GPL-3.0-only
|
||||||
|
@ -45,10 +45,10 @@ function get_url() // Extract URL from HTML.
|
||||||
const html = document.getElementsByTagName('html')[0].innerHTML;
|
const html = document.getElementsByTagName('html')[0].innerHTML;
|
||||||
const re_mp4 = new RegExp('"(https://[^",]+\.mp4)"', 'g');
|
const re_mp4 = new RegExp('"(https://[^",]+\.mp4)"', 'g');
|
||||||
|
|
||||||
let result = html.match(re_mp4);
|
let result = [...html.matchAll(re_mp4)];
|
||||||
if (result !== null)
|
if (result !== null)
|
||||||
{
|
{ // Return the last match.
|
||||||
return result[result.length - 1].replace(/"/g, "");
|
return result[result.length - 1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue