Skip to content

Instantly share code, notes, and snippets.

@noromanba
Last active April 23, 2017 16:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noromanba/34b7ba05dbccb4fa844c18a88ff38d89 to your computer and use it in GitHub Desktop.
Save noromanba/34b7ba05dbccb4fa844c18a88ff38d89 to your computer and use it in GitHub Desktop.
specs of showroom-live.com HLS m3u8 URL

showroom-live.com HLS specs

specs of showroom-live.com HLS m3u8 URL

URL syntax

showroom-live URL

https://www.showroom-live.com/<ROOM_URL_KEY>

<ROOM_URL_KEY> : this is inside name, about room-id/name

HLS

http://NNN.NNN.NNN.NNN:NNNN/liveedge/<64_DIGIT_HASH>/playlist.m3u8
A : ~=48 - 96+kbps mono 44.1kHz 1ch AAC LC v4
V : ~=100 - 1000+kbps AVC Baseline@L3 640x360p
AV: MPEG-TS mp4

fetch ASAP

these codes under the those license

js w/ (headless)Browser

// @author  noromanba   http://noromanba.flavors.me
// @license MIT license https://nrm.mit-license.org/2016
(() => {
  'use strict';

  // TBD error check, guard block
  //*/
  // from <script> in <head> or more
  const url = JSON.parse(document.querySelector([
    '#js-initial-data'
  ]).dataset.json).streamingUrlHls;
  /*/
  // from global object; probably `DOMContentLoaded` or later
  const url = SrGlobal.livedata.streaming_url_hls;
  //*/

  // optional
  const title = document.title;

  return `${title}
${url}`;
})();

Bookmarklet

javascript:(()=>{'https://gist.github.com/noromanba/34b7ba05dbccb4fa844c18a88ff38d89#bookmarklet';const url=JSON.parse(document.querySelector(['#js-initial-data']).dataset.json).streamingUrlHls;const title=document.title;window.prompt(title,url);})();

min basecode

// @author  noromanba   http://noromanba.flavors.me
// @license MIT license https://nrm.mit-license.org/2016
(() => {
  const url = JSON.parse(document.querySelector([
    '#js-initial-data'
  ]).dataset.json).streamingUrlHls;

  const title = document.title;

  window.prompt(title, url);
})();

Terminal

can use static HTML, require http GET only; so fast! but hardcore oneliner training

HLS m3u8

SrGlobal.livedata JSON syntax;

"streaming_url_hls":"http:\/\/NNN.NNN.NNN.NNN:NNNN\/liveedge\/<64_DIGIT_HASH>\/playlist.m3u8"

\ escaped, so

GET https://www.showroom-live.com/<ROOM_URL_KEY> | grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | tr -d '\\' | head -1
# wrapped ver
GET https://www.showroom-live.com/<ROOM_URL_KEY> | \
grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | \
tr -d '\\' | head -1

title

if needed;

GET https://www.showroom-live.com/<ROOM_URL_KEY> | grep -o -P '<title>\K.+(?=</title>)'
# wrapped ver
GET https://www.showroom-live.com/<ROOM_URL_KEY> | \
grep -o -P '<title>\K.+(?=</title>)'

or

GET https://www.showroom-live.com/<ROOM_URL_KEY> | grep -o -P '(?<=<title>).+(?=</title>)'
# wrapped ver
GET https://www.showroom-live.com/<ROOM_URL_KEY> | \
grep -o -P '(?<=<title>).+(?=</title>)'

difference between 2-methods, ignore-left RegExp pattern only; \K or (?<=)

CLI w/ external player

e.g. vlc/mpv

mpv $(GET https://www.showroom-live.com/<ROOM_URL_KEY> | grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | tr -d '\\' | head -1)
# wrapped ver
mpv $(GET https://www.showroom-live.com/<ROOM_URL_KEY> | \
grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | \
tr -d '\\' | head -1)
vlc $(GET https://www.showroom-live.com/<ROOM_URL_KEY> | grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | tr -d '\\' | head -1)
# wrapped ver
vlc $(GET https://www.showroom-live.com/<ROOM_URL_KEY> | \
grep -o -P '"streaming_url_hls"\s*:\s*"\K[^"]+' | \
tr -d '\\' | head -1)

c.f.

this UserScript depends on jQuery, XHR to endpoint approach

perhaps DOMContentLoaded, load or later

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