Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyu8866 authored May 21, 2024
1 parent d2e4691 commit 50242fa
Show file tree
Hide file tree
Showing 13 changed files with 20,852 additions and 0 deletions.
73 changes: 73 additions & 0 deletions m3u8/cctv.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cctv视频下载</title>
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="renderer" content="webkit">
<meta name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="shortcut icon" href="favicon.ico">
<style>
body { text-align: center } header { margin: 20px 0; } header h1 { width: 280px; margin: 0 auto; } html { font-size: 62.5%; font-family: 'microsoft yahei', Simsun, sans-serif; } blockquote, body, button, code, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, hr, input, legend, li, ol, p, pre, td, textarea, th, ul { margin: 0; padding: 0 } h1, h2, h3, h4, h5, h6 { font-size: 100%; font-family: arial, 'hiragino sans gb', 'microsoft yahei', Simsun, sans-serif } li { list-style: none } a:link, a:visited { text-decoration: none } body { font-size: 12px; line-height: 1.333 } .clear { clear: both; } .cont { width: 1200px; margin: 0 auto; } #ckplays { min-height: 300px; background: #eee } #footer { margin-top: 30px; color: #111; text-align: center } @media screen and (min-width:0px) and (max-width:900px) { .cont { width: auto; min-width: auto; } .navigation-up .navigation-v3 { margin: 0; } #ckplays { width: 100%; min-height: 260px; height: auto; } .searchs .text { width: 80%; } } iframe { width: 100%; height: 600px; }
</style>
<link href="https://s3.pstatp.com/cdn/expire-1-M/amazeui/2.7.2/css/amazeui.min.css" type="text/css"
rel="stylesheet" />
</head>

<body>
<div class="cont am-margin-top-lg">
<div class="am-u-lg-12 am-margin-bottom-lg" style="padding:0;">
<div class="am-input-group">
<!-- <input type="text" class="am-form-field" id="m3u8url" placeholder="请输入cctv视频地址"> -->
<span class="am-input-group-btn">
<button class="am-btn am-btn-default" type="button" onclick="run()">播放不了?切换</button>
</span>
</div>
</div>
<div class="clear"></div>
<div id="ckplays" class="am-margin-bottom-lg"></div>
<iframe id="iframe" style="display: none;" frameborder="0"></iframe>
</div>
<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.0.0/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/hls.js/1.4.12/hls.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/dplayer/1.27.1/DPlayer.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/m3u8-parser/7.1.0/m3u8-parser.min.js"></script>
<script src="m3u8Player.js"></script>
<script>
let title = '', guid = '';
const host = ['myhwcdn.cn', 'kcdnvip.com', 'myalicdn.com'];
let index = 0;
const iframe = $('#iframe'), iframeSrc = 'download.html';
const myPlayer = new m3u8Player(document.getElementById('ckplays'), function (e) {
iframe.attr('src', iframeSrc + '?source=' + e.url + '&title=' + title);
});

(function init() {
guid = getUrlParam("guid");
title = getUrlParam("title");
if (title) title += encodeURIComponent('_' + '1280*720P')
if (guid) run()
})()

function run() {
if (index >= host.length) {
alert('没有播放源了');
return;
}
myPlayer.render(`https://hls.cntv.${host[index]}/asp/hls/2000/0303000a/3/default/${guid}/2000.m3u8`);
iframe.show();
index++;
}

function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return r[2]; return '';
}
</script>
</body>

</html>
93 changes: 93 additions & 0 deletions m3u8/compress.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>图片压缩</title>
<link href="https://cdn.bootcdn.net/ajax/libs/layui/2.8.17/css/layui.min.css" rel="stylesheet">
</head>

<body>
<div class="layui-main layui-padding-3">
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">图片宽度</label>
<div class="layui-input-inline">
<input type="number" name="width" autocomplete="off" placeholder="请输入" lay-verify="required" value="1000" class="layui-input">
</div>
<div class="layui-form-mid layui-text-em">压缩后的图片宽度</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">压缩比例</label>
<div class="layui-input-inline">
<input type="number" name="quality" autocomplete="off" placeholder="请输入" lay-verify="required" value="0.8" step="0.1" min="0" max="1" class="layui-input">
</div>
<div class="layui-form-mid layui-text-em">降低画质比例,0-1(值越小越模糊)</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片列表</label>
<div class="layui-input-block">
<input id="file_dom" type="file" multiple style="margin: 6px 0 0 8px;" >
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="demo2">下载</button>
</div>
</form>
</div>
<script src="https://unpkg.com/[email protected]/dist/index.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layui/2.8.17/layui.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script>
layui.use(['form', 'layer'], function () {
const form = layui.form;
const layer = layui.layer;
form.on('submit(demo2)', data => {
download();
return false;
})

let fileList = [];
document.getElementById("file_dom").onchange = function () {
const maxWidth = document.querySelector('input[name=width]').value;
const quality = document.querySelector('input[name=quality]').value;
const compress = new imgZip({ quality: quality, width: maxWidth });
fileList = [];

for (let i = 0; i < this.files.length; i++) {
compress.photoCompress(this.files[i], base64 => {
fileList.push({
name: this.files[i].name,
img: imgZip.convertBase64UrlToBlob(base64)
})
});
}
};

function download() {
if (fileList.length == 0) {
layer.msg('无内容', { icon: 5 });
return false;
}
if (fileList.length == 1) {
saveAs(fileList[0].img, fileList[0].name);
return false;
}
const zip = new JSZip();
fileList.forEach(item => {
zip.file(item.name, item.img);
})
zip.generateAsync({
type: 'blob'
}).then(content => {
saveAs(content, '图片列表.zip')
})
}
})
</script>
</body>

</html>
Loading

0 comments on commit 50242fa

Please sign in to comment.