ndr_download_button: Replace hq.mp4 with mp3 for audio files.

This commit is contained in:
tastytea 2019-06-17 13:05:50 +02:00
parent 3c88b413c6
commit b780ad9e75
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@
// @name NDR download button // @name NDR download button
// @description Adds a download-button for every video and audio on ndr.de. // @description Adds a download-button for every video and audio on ndr.de.
// @description:de Fügt einen download-button für jedes videos und audio auf ndr.de hinzu. // @description:de Fügt einen download-button für jedes videos und audio auf ndr.de hinzu.
// @version 2019.06.17.1 // @version 2019.06.17.2
// @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
@ -20,10 +20,14 @@ function get_video_url()
{ {
const element = document.querySelector('[itemprop=contentUrl]'); const element = document.querySelector('[itemprop=contentUrl]');
let url = element.getAttribute("content"); let url = element.getAttribute("content");
if (url.search("/TV-") > -1) // Only replace in URL if it is a video. if (url.search("/TV-") > -1) // Upgrade Videos to HD.
{ {
url = url.replace("hq.mp4", "hd.mp4"); url = url.replace("hq.mp4", "hd.mp4");
} }
else if (url.search("/AU-") > -1) // The advertised MP4 file does not exist.
{
url = url.replace("hq.mp4", "mp3");
}
return url; return url;
} }