LiveMe Replay M3U8 URL

Get the M3U8 URL for a LiveMe replay

  1. // ==UserScript==
  2. // @author Arnold François Lecherche
  3. // @description Get the M3U8 URL for a LiveMe replay
  4. // @name LiveMe Replay M3U8 URL
  5. // @namespace greasyfork.org
  6. // @version 1.0.0
  7. // @icon https://www.liveme.com/favicon.ico
  8. // @include http://liveme.com/live.html?*
  9. // @include http://*.liveme.com/live.html?*
  10. // @include https://liveme.com/live.html?*
  11. // @include https://*.liveme.com/live.html?*
  12. // @license MIT
  13. // @grant none
  14. // @run-at document-end
  15. // @copyright 2018 Arnold François Lecherche
  16. // ==/UserScript==
  17.  
  18. (function (d, s){
  19. 'use strict';
  20. var replay = d.querySelector('a.replay'), title = replay && d.querySelector('h1.crumb'), regexp = /https?:\/\/[^:]+?\.m3u8/;
  21. function findURL() {
  22. var matches = regexp.exec(d.documentElement.innerHTML);
  23. replay.removeEventListener('click', findURL, true);
  24. if (matches) title.innerHTML += ' | <a href="' + matches[0] + '" style="color: blue;">M3U8 Link</a>';
  25. else s(findURL, 50);
  26. }
  27. if (title) replay.addEventListener('click', findURL, true);
  28. })(document, setTimeout);