LiveMe Replay M3U8 URL

Get the M3U8 URL for a LiveMe replay

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @author Arnold François Lecherche
// @description Get the M3U8 URL for a LiveMe replay
// @name LiveMe Replay M3U8 URL
// @namespace greasyfork.org
// @version 1.0.0
// @icon https://www.liveme.com/favicon.ico
// @include http://liveme.com/live.html?*
// @include http://*.liveme.com/live.html?*
// @include https://liveme.com/live.html?*
// @include https://*.liveme.com/live.html?*
// @license MIT
// @grant none
// @run-at document-end
// @copyright 2018 Arnold François Lecherche
// ==/UserScript==

(function (d, s){
  'use strict';
  var replay = d.querySelector('a.replay'), title = replay && d.querySelector('h1.crumb'), regexp = /https?:\/\/[^:]+?\.m3u8/;
  function findURL() {
    var matches = regexp.exec(d.documentElement.innerHTML);
    replay.removeEventListener('click', findURL, true);
    if (matches) title.innerHTML += ' | <a href="' + matches[0] + '" style="color: blue;">M3U8 Link</a>';
    else s(findURL, 50);
  }
  if (title) replay.addEventListener('click', findURL, true);
})(document, setTimeout);