- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用Youtube API 收集数据,然后我使用node.js
影片下载。
最后,我在经典 html5 上使用视频 <video>
标签。
由于某些原因,有些视频效果很好,有些则不行。
我在服务器部分使用这个包 - >
https://www.npmjs.com/package/youtube-dl
if (request.url.search(/.nidza|.dzoni/g) != -1) {
// file.serveFile('bad.html', 402, {}, request, response);
const localVid = request.url.split("?vid=")
console.log("videoID => ", localVid[1])
console.log("Vule bule request.url., ", request.url)
const addressLink = 'http://www.youtube.com/watch?v=' + localVid[1]
const checkvideo = '../dist/videos/vule' + localVid[1] + '.mp4'
try {
if (fs.existsSync(checkvideo)) {
// file exists
console.log("skip...")
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('[video-exist]');
return;
}
} catch(err) {
console.error(err)
}
const myPromise = new Promise((resolve, reject) => {
var test = youtubedl(addressLink, ['--format=18'], { cwd: __dirname })
try{
resolve(test)
} catch(err) {
reject(err)
}
}).then((video) => {
video.on('info', function(info) {
console.log('Download started')
console.log('filename: ' + info._filename)
console.log('size: ' + info.size)
})
const videoName = '../dist/videos/vule' + localVid[1] + '.mp4';
video.pipe(fs.createWriteStream(videoName, {
flag: "w+"
}))
}).catch(function(err) {
reject().than(()=>{
console.log("Error in promise youtubedl => ", err)
})
});
response.writeHead(200, {'Content-Type': 'text/plain'})
response.end(`VuleTube service version 0.3.1 \n
https://maximumroulette.com:3000 `)
}
Link for server node.js
f an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23569) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Request contains invalid range header: [ '0', '' ]
Error: Range request present but invalid, might serve whole file instead
at Server.respondNoGzip (/var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:297:23)
at Server.respond (/var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:350:14)
at /var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:146:22
at FSReqWrap.oncomplete (fs.js:166:5)
Range request exceeds file boundaries, goes until byte no 524287 against file size of 1312 bytes
Error: Range request present but invalid, might serve whole file instead
at Server.respondNoGzip (/var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:297:23)
at Server.respond (/var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:350:14)
at /var/www/html/applications/vue-project/vue-typescript-starter/vue-ts-starter/server/node_modules/node-static/lib/node-static.js:64:22
at FSReqWrap.oncomplete (fs.js:166:5)
有什么建议。
最佳答案
某些视频不起作用,因为 Youtube 并不总是在请求时公开其视频的网址。
Youtube-DL 向 http://www.youtube.com/get_video_info?video_id=XXXX
发出请求(其中 XXXX
是视频 ID),这将返回一个 JSON 文本文件,其中包含与请求的视频上传相关联的 MP4/webM/M4A、OGG 等的文件 URL 列表。
例如:
(1) 正在工作:您可以找到 googlevideo.com
JSON 中提到的链接(MP4 等)
匹诺曹(预告片):http://www.youtube.com/get_video_info?video_id=y8UDuUVwUzg
(2) 不工作:您找不到 googlevideo.com
此 JSON 中的链接(没有可下载的视频链接)
Mirage(全片):http://www.youtube.com/get_video_info?video_id=FTY-L-l3KN8
关于html - youtube-dl 不适用于所有 youtube 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64650797/
所以我有一个类似这样的 dl 列表: .title { display: inline-block; padding-bottom: 20px; } dd { -moz-margin-st
我想使用代理并运行它youtube-dl --proxy socks5://127.0.0.1:1080 这是下面的错误 Usage: youtube-dl [OPTIONS] URL [URL...
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 2年前关闭。 Improve thi
[Windows 10] 我有一个包含 128 个项目的视频播放列表 URL,我已经从同一个播放列表 URL 下载了 25 个视频。现在我想从 26 索引开始下载剩余的视频,但我无法使用 --paly
我正在使用 youtube-dl 从 youtube 下载播放列表。我使用自动编号功能对视频进行编号,这可以通过格式化输出文件的名称来实现,如下 -o "%(autonumber)s-%(title)
我正在显示 的列表tags 我页面中的标签。我想要 当标签的内容足够长以超出 的高度时不换行. 什么 css 可以防止这种情况发生? 最佳答案 我会使用 margin-left在 上等于 的宽
此命令下载视频并将自动生成的 youtube 字幕嵌入到文件中 youtube-dl.exe -ci -f "bestvideo[ext=mp4]"+"bestaudio[ext=m4a]" --wr
我在fedora 116上使用gcc/g++,我的想法是: c program -> load c++ dynamic library A -> load c++ dynamic library B
嗯,我可以在终端中使用它直接获取视频格式 - $ youtube-dl -F "some youtube url" 输出: [youtube] Setting language [youtube] P
我的 youtube-dl 库 ( https://rg3.github.io/youtube-dl/ ) 有问题。我使用 youtube-dl 不是通过这个库直接下载视频,而是我首先使用这样的命令生
关闭。这个问题需要details or clarity .它目前不接受答案。 想要改进这个问题吗? 通过 editing this post 添加详细信息并澄清问题. 关闭 8 年前。 Improve
我是 Android Studio 的新手,每次我尝试将项目与 gradle 同步时都会收到此错误。例如,我提供了对三个文件的引用。 1)项目级build.gradle文件 plugins {
更新 Gradle 后出现以下问题。我找不到任何解决方案。所以请帮我解决以下问题。提前致谢... (问题 ----- 无法获取“https://dl.google.com/dl/android/mav
我最近开始使用 react native,但是根据伊朗人的制裁,gradle 不能构建我的第一个项目,所以我使用了 VPN 和 shecan service但我收到以下错误: 我阅读了 React n
在Firebase身份验证(助手)中使用将Firebase身份验证添加到您的应用程序时出错。 该错误在“同步”标签中显示为: Could not GET 'https://dl.google.com/
我无法在 Android Studio 中构建项目,并且收到以下错误。 Gradle 同步失败。 无法获取“https://dl.google.com/dl/android/maven2/com/an
我正在尝试将 youtube 视频保存为我的下载文件夹中的 MP3。但是,这最终会将文件保存在与 youtube-dl 相同的目录中。 youtube-dl --extract-audio --aud
我正在使用 youtube-dl用于从 YouTube 下载视频。但是在我的办公室,互联网会每隔 20Mb 断开一次。的下载。 [错误:连接被远程服务器强行关闭]。 我必须再次输入 URL 才能继续下
好的,我知道要在您使用的python程序中从Youtube-DL获取Mp3文件 from __future__ import unicode_literals import youtube_dl yd
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我是一名优秀的程序员,十分优秀!