// ==UserScript== // @name 战旗直播地址解析 // @namespace https://guihet.com/ // @version 1.0.1 // @description 打开战旗官网的任意直播间即可自动解析出m3u8格式的永久有效直播源地址,该地址可以用PotPlayer或VLC或其他自定义URL的播放器打开播放.. // @author 黑鸟博客 // @include http://www.zhanqi.tv/* // @include https://www.zhanqi.tv/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function heredoc(fn) { return fn.toString().split('\n').slice(1,-1).join('\n') + '\n' } var boxHtml = ''; if(window.oPageConfig.oRoom.status !='4'){ boxHtml = '状态: 未知
'; } if(window.oPageConfig.oRoom.status =='4'){ boxHtml = '状态: 正在直播
'; try{ var absUrl = window.oPageConfig.oRoom; var absUrlzq = absUrl.videoId; var preURL ="http://alhls.cdn.zhanqi.tv/zqlive/"; var lastURL = ".m3u8"; boxHtml += '
复制
'; boxHtml += '

BY 黑鸟博客

'; }catch(e){ boxHtml += '解析流数据错误'; console.error(e); } } if(window.oPageConfig.oRoom.status !='4'){ boxHtml = '状态: 未知
'; boxHtml += '当前无法解析流数据'; } window.toggleFlvUrlBox = function() { var flvUrlBoxBtn = document.getElementById('flv-url-box-btn'); var flvUrlBox = document.getElementById('flv-url-box'); if(flvUrlBox.style.display==='none'){ flvUrlBox.style.display='block'; }else{ flvUrlBox.style.display='none'; } } window.copyFlvUrl = function(index) { var input = document.getElementById('flv-url-'+index); input.select(); document.execCommand("Copy"); } window.openFlvUrl = function(index) { var input = document.getElementById('flv-url-'+index); var url = input.value; location.href = "vlc://"+url } var wrapper = document.createElement("div"); wrapper.style.display = 'inline-block'; wrapper.innerHTML = heredoc(function(){/*
*/}).replace('__box_html__', boxHtml); document.body.append(wrapper); })();