Skip to content

Commit

Permalink
添加直播源下载功能
Browse files Browse the repository at this point in the history
  • Loading branch information
HeiSir committed Jun 18, 2020
1 parent 7ff957b commit c8022b9
Show file tree
Hide file tree
Showing 10 changed files with 1,101 additions and 267 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# M3U8-Downloader
HLS Downloader,一个Electron App,可以下载、播放HLS视频流。

![HLSDownload Show](https://github.com/HeiSir2014/M3U8-Downloader/blob/master/resource/HLSDownloadShow.gif?raw=true)
![HLSDownload Show](https://github.com/HeiSir2014/M3U8-Downloader/blob/master/resource/HLSDownloadShow-2.gif?raw=true)

# 官网
[M3U8-Downloader 官网](https://tools.heisir.cn/HLSDownload)
Expand All @@ -18,3 +18,31 @@ QQ交流群:341972319
目前仅编译了Windows Release.

下载地址:[Release](https://github.com/HeiSir2014/M3U8-Downloader/releases)

# 运行源码
### 1.NodeJS开发环境搭建

安装NodeJs最新版,[NodeJs Download](http://nodejs.cn/download/)

### 2.Clone 代码

在任意文件夹下新建一个文件夹存放代码,并执行以下命令
```
cd newdir
git clone https://github.com/HeiSir2014/M3U8-Downloader.git .
```

### 3.环境初始化

```
npm install
```

### 4.运行M3U8-Downloader

```
npm run start2
```

### 5.Enjoy it
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ html{
.heisir .main .TaskList{
width: 85%;
height: calc(100% - 160px);
margin: 40px auto;
margin: 15px auto;
padding: 10px;
overflow-y: auto;
padding: 0px;
border-radius: 28px;
Expand Down
40 changes: 40 additions & 0 deletions ffmpegTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use strict";
const ffmpeg = require('fluent-ffmpeg');
const fs = require('fs');
const { Readable} = require('stream');
const path = require('path');


const dir = 'E:\\Project\\my_project\\M3U8-Downloader\\source\\download\\1592447619950\\';
let inputStream = new Readable();
let _ffmpeg = ffmpeg(inputStream)
.setFfmpegPath('E:\\Project\\my_project\\M3U8-Downloader\\source\\ffmpeg.exe')
.videoCodec('copy')
.audioCodec('copy')
.save("E:\\Project\\my_project\\M3U8-Downloader\\source\\download\\1592447619950\\output.mp4")
.on('progress', function(info) {
console.log(info);
})
.on('end', function() {
console.log('done processing input stream');
})
.on('error', function(err) {
console.log('an error happened: ' + err.message);
});

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

fs.readdir(dir,function(err,files){
for (let index = 0; index < files.length; index++) {
const file = files[index];
if(file.endsWith(".ts"))
{
inputStream.push( fs.readFileSync(path.join(dir,file)) );
//console.log(`file : ${index}`);
}
}
inputStream.push(null);
});

3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="css/style.css">
</head>
<body class="heisir">
<div class="header"><span class="title">M3U8-Downloader v1.0.4</span>
<div class="header"><span class="title">M3U8-Downloader v1.0.5</span>
<div class="space"></div>
<a class="home" href="https://tools.heisir.cn/HLSDownload/" target="_blank">官网</a>
<a class="qqgroup" href="https://jq.qq.com/?_wv=1027&k=nhFrZBS0">点击加群</a>
Expand All @@ -35,6 +35,7 @@
<div class="opt bottom">
<input class="del" type="button" value="删除">
<input class="play" type="button" value="播放">
<input class="StartStop" type="button" value="停止">
</div>
</div>
<div class="empty">
Expand Down
Loading

0 comments on commit c8022b9

Please sign in to comment.