Sleazy Fork is available in English.

直播接口改直播盒子

将txt格式的直播接口改成直观的图文列表

  1. // ==UserScript==
  2. // @name 直播接口改直播盒子
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9
  5. // @description 将txt格式的直播接口改成直观的图文列表
  6. // @author qm3.top
  7. // @match http://api.hclyz.com:81/mf/*.txt*
  8. // @match http://api.zbjk.xyz:81/mf/*.txt*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. document.title = "\u79cb\u540d\u5c71\u4e0a\u0020\u4e0d\u89c1\u4e0d\u6563";
  15. var add="",num="",img="",li="",list=[];
  16. var html = document.querySelector("body pre").innerHTML;
  17. var style = document.createElement('style');
  18. style.innerHTML = '*{margin:0;padding:0;list-style:none;box-sizing:border-box;scroll-behavior:smooth;}'
  19. +'ul{width:100%;height:100%;overflow:hidden;overflow-y:scroll;-webkit-overflow-scrolling: touch;}'
  20. +'li{float:left;padding:10px;overflow:hidden;}'
  21. +'.img{width:100%;height:auto;padding-bottom:100%;overflow:hidden;position:relative}'
  22. +'img{width:100%;height:100%;position: absolute;}'
  23. +'.title{width:100%;text-align:center;word-break: keep-all;white-space: nowrap;overflow:hidden;transition:all .3s}'
  24. +'li:hover .title{color:#f93ab3}';
  25. document.head.appendChild(style);
  26. var meta = document.createElement('meta');
  27. meta.name = "referrer";
  28. meta.content = "no-referrer";
  29. document.head.appendChild(meta);
  30. var c = isNaN(window.location.href.split("?")[1])?"width:25%":"width:"+100/window.location.href.split("?")[1]+"%";
  31. html.indexOf("pingtai")>0?(list = JSON.parse(html).pingtai,img = "xinimg"):(list = JSON.parse(html).zhubo,img = "img")
  32. for(var i = 0;i<list.length;i++){
  33. list[i].Number!=null?(num = "("+ list[i].Number +")",add = list[i].address+window.location.search):(num="",add = "http://fs3.top/?url="+list[i].address);
  34. var title = list[i].title.replace(/%25/g,"%").replace(/%28/g, "(").replace(/%29/g, ")").replace(/%3F/g,"?").replace(/%20/g," ").replace(/%7E/g,"~").replace(/%5E/g,"^");
  35. li+='<li style="'+c+'"><p class="img"><a target="_blank" href="'+add+'"><img src="'+list[i][img]+'"></a></p><p class="title">'+title+num+'</p></li>';
  36. }
  37. document.querySelector("body").innerHTML = "<ul>"+li+"</ul>";
  38.  
  39. })();