Skip to content

Instantly share code, notes, and snippets.

@uahim
Last active December 17, 2022 14:15
Show Gist options
  • Save uahim/b0c4b43101440b1f1525ef647025a9f2 to your computer and use it in GitHub Desktop.
Save uahim/b0c4b43101440b1f1525ef647025a9f2 to your computer and use it in GitHub Desktop.
shows the stream url to watch in VLC or to feed into ffmpeg, youtube-dl or its various forks; fix to match non-fictional content
// stream url to watch in VLC or to feed into ffmpeg, youtube-dl or its various forks
// displayed line-by-line for better readability
javascript:
var id = location.href.split("/");
var urlp = "https://dms.redbull.tv/v5/destination/stv/";
var urls = "/personal_computer/chrome/de/de_DE/playlist.m3u8";
var properid = id[id.length - 2].toUpperCase();
if (properid.match(/^AA/) != null) {
var filmtitle = document.querySelector('meta[property="og:title"]').content;
filmtitle = filmtitle.replace(/ /g, "_").replace(/[^a-z0-9%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%B1%C3%BC \.,_-]/gim, "");
var test = prompt("stream URL (OK for ffmpeg command or cancel)", urlp + properid + urls);
if (test !== null) {
prompt("ffmpeg command", 'ffmpeg -referer "' + location.href + '" -user_agent "%ua%" -i "' + urlp + properid + urls + '" -c copy -bsf:a aac_adtstoasc "' + filmtitle + '.mp4"');
}
} else {
alert("can't detect programme ID")
}
void(0);
// the same code in one line - just copy & paste it
javascript: var id = location.href.split("/"); var urlp = "https://dms.redbull.tv/v5/destination/stv/"; var urls = "/personal_computer/chrome/de/de_DE/playlist.m3u8"; var properid = id[id.length - 2].toUpperCase(); if (properid.match(/^AA/) != null) { var filmtitle = document.querySelector('meta[property="og:title"]').content; filmtitle = filmtitle.replace(/ /g, "_").replace(/[^a-z0-9%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%B1%C3%BC \.,_-]/gim, ""); var test = prompt("stream URL (OK for ffmpeg command or cancel)", urlp + properid + urls); if (test !== null) { prompt("ffmpeg command", 'ffmpeg -referer "' + location.href + '" -user_agent "%ua%" -i "' + urlp + properid + urls + '" -c copy -bsf:a aac_adtstoasc "' + filmtitle + '.mp4"'); } } else { alert("can't detect programme ID") } void(0);
@uahim
Copy link
Author

uahim commented Jul 21, 2022

@MuenchenSued where does this not work for you?

I just checked and e.g.
https://www.servustv.com/unterhaltung/v/aa-1r1vuh6ys1w12/
still works as of today
stillworks

@LinuxOpa
Copy link

@uahim
Copy link
Author

uahim commented Jul 21, 2022

@LinuxOpa nice, thanks

@MuenchenSued
Copy link

MuenchenSued commented Jul 22, 2022

where does this not work for you?

I used it weeks ago with firefox but yesterday I faced the problem, that no link was shown. I then tried the code via console and there it worked. But as a bookmarklet it won't. My code is the following:


javascript:
alert ("start"); 
var id = location.href.split("/");
var properid = id[id.length-2].toUpperCase(); 
var filmtitle=document.getElementsByClassName("css-271md e6j4vot6")[0].innerText; 
filmtitle=filmtitle.replace(/ /g, "_"); 
prompt("ffmpeg:", 'ffmpeg -referer "'+location.href+'" -user_agent "%ua%" -i "'+'https://dms.redbull.tv/v5/destination/stv/'+properid+'/personal_computer/chrome/de/de_DE/playlist.m3u8'+'" -c copy -bsf:a aac_adtstoasc "'+filmtitle+'.mp4"');
void(0);

I see the "start" alert but no prompted link. A second alert after the filmtitle extraction is also not shown. I will add some more outputs to see, where the script really stops. It could be, that a firefox addon or a new security setting has changes the behaviour.

PS: OMG: I used an old code shown under "previous, splitted" but tested the newer code in the console. I changed my bookmarklet to the combined code and now it works again.

@uahim
Copy link
Author

uahim commented Jul 22, 2022

@MuenchenSued ah yes, the old code was not always working, I just removed it to avoid confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment