// ==UserScript== // @name 获取虎牙直播流地址,可直接使用VLC播放器播放 // @namespace http://tampermonkey.net/ // @version 0.6 // @description 获取虎牙直播流地址,可直接使用VLC播放器播放,在VLC内选择Open Network,粘贴地址打开即可 // @author xiaozhuai // @include http://www.huya.com/* // @include https://www.huya.com/* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/369417/%E8%8E%B7%E5%8F%96%E8%99%8E%E7%89%99%E7%9B%B4%E6%92%AD%E6%B5%81%E5%9C%B0%E5%9D%80%EF%BC%8C%E5%8F%AF%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8VLC%E6%92%AD%E6%94%BE%E5%99%A8%E6%92%AD%E6%94%BE.user.js // @updateURL https://update.greasyfork.icu/scripts/369417/%E8%8E%B7%E5%8F%96%E8%99%8E%E7%89%99%E7%9B%B4%E6%92%AD%E6%B5%81%E5%9C%B0%E5%9D%80%EF%BC%8C%E5%8F%AF%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8VLC%E6%92%AD%E6%94%BE%E5%99%A8%E6%92%AD%E6%94%BE.meta.js // ==/UserScript== // 本人是韦神大叔粉,请大家支持韦神。 // 韦神资料: // 绝地求生4AM队长,前英雄联盟LPL总冠军获得者。 // 2018 PUBG China Pro Invitation (PCPI) TPP模式冠军获得者。 // 4AM兄弟齐心,一千多斤! // 韦神直播间地址: // https://www.huya.com/godv (function() { 'use strict'; function heredoc(fn) { return fn.toString().split('\n').slice(1,-1).join('\n') + '\n' } var boxHtml = ''; if(window.TT_ROOM_DATA.state==='OFF'){ boxHtml = '状态: 未开播
'; } if(window.TT_ROOM_DATA.state==='ON'){ boxHtml = '状态: 正在直播
'; try{ var streamInfoList = window.hyPlayerConfig.stream.data[0].gameStreamInfoList; var data = []; for(var line=0; line复制'; //VLC播放 } }catch(e){ boxHtml += '解析流数据错误'; console.error(e); } } if(window.TT_ROOM_DATA.state==='REPLAY'){ 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); })();