LiveMe Replay M3U8 URL

Get the M3U8 URL for a LiveMe replay

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);