ard_download_button: I made it way too complicated, lol. m)
This commit is contained in:
parent
5b6d87d24d
commit
2f1f7d718e
|
@ -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.7
|
// @version 2019.06.22.8
|
||||||
// @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
|
||||||
|
@ -43,12 +43,7 @@ function main()
|
||||||
function get_url() // Extract URL from HTML.
|
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( // ARD
|
const re_mp4 = new RegExp('"(https://[^",]+\.mp4)"', 'g');
|
||||||
'"(https://pdvideosdaserste-a\.akamaihd\.net/[^"]+/[0-9]+-[^"/]+\.mp4)"', 'g');
|
|
||||||
const re_516 = new RegExp( // ARD (?)
|
|
||||||
'"(https://pdvideosdaserste-a\.akamaihd.net/[^"]+format[0-9]+\.mp4)"', 'g');
|
|
||||||
const re_m3u = new RegExp( // MDR
|
|
||||||
'"(https://[^,"]+\.akamaihd\.net/[^,"]+master\.m3u8)"');
|
|
||||||
|
|
||||||
let result = html.match(re_mp4);
|
let result = html.match(re_mp4);
|
||||||
if (result !== null)
|
if (result !== null)
|
||||||
|
@ -56,19 +51,6 @@ function get_url() // Extract URL from HTML.
|
||||||
return result[result.length - 1].replace(/"/g, "");
|
return result[result.length - 1].replace(/"/g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = html.match(re_516);
|
|
||||||
if (result !== null)
|
|
||||||
{
|
|
||||||
return result[result.length - 1].replace(/"/g, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
result = re_m3u.exec(html);
|
|
||||||
if (result !== null)
|
|
||||||
{
|
|
||||||
// TODO: Actually read master.m3u and select the best stream.
|
|
||||||
return result[1].replace("/master.m3u8", "/index_3584000_av.m3u8");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue