Skip to content

Instantly share code, notes, and snippets.

@wlerin
Forked from queile/showroom.url.user.js
Last active April 23, 2020 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlerin/89a12362451490b1b18ac086bca59275 to your computer and use it in GitHub Desktop.
Save wlerin/89a12362451490b1b18ac086bca59275 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name show Showroom streaming url
// @namespace https://gist.github.com/wlerin
// @description ShowroomのストリーミングURLを表示
// @include https://www.showroom-live.com/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @version 0.6
// ==/UserScript==
// Will display a streaming url in a box at the top of the screen
// pass that URL off to mpv or another player of your choice to watch the stream there instead of in a browser
function getStreamingUrl (room_id) {
$.ajax({
url: "/api/live/streaming_url",
type: "GET",
data: {room_id:room_id}
}).done(function(data, status, xhr) {
if (room_id == null) {
return false;
};
$('body').prepend($('<textarea>')
.val(data.streaming_url_list[0].url +
(data.streaming_url_list[0].stream_name ? '/' + data.streaming_url_list[0].stream_name : '')
)
.css('width','100%')
.focus(function(){
setTimeout(function(){$(this).select();},0);
})
.click(function(){
$(this).select();
return false;
})
);
});
};
var room_id = SRApp.store.get("roomId")
if (room_id != null) {
getStreamingUrl(room_id)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment