微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用wget下载YouTubevideo

我通常使用keepvid.com或Firefox下载助手插件来下载YouTubevideo。 是否可以使用Linux中提供的wget命令下载它们?

另外,我有一个VPS服务器。 我想在我的VPS服务器(cPanel)上下载video。

如果有可能,如果有可能如何?

谢谢。

内核通过/ dev / mtd更新

使用Linux shell脚本在string中的位置?

为什么我要在Dockerfile中使用VOLUME?

简单的Linux IPC问题

用awksearch多个条件string

了解一个进程在Linux上等待I / O的时间

stty:标准input:使用pdsh或ssh时参数无效

Linux和I / O完成端口?

如何在C编写一个http1.0代理服务器在Linux?

在本地安装zlib

#!/usr/bin/perl use strict; use warnings; ## Two arguments ## $1 YouTube URL from the browser ## $2 Prefix to the file name of the video (optional) # ## Collect the URL from the command line argument my $url = $ARGV[0] or die "nError: You need to specify a YouTube URLnn"; ## Declare the user defined file name prefix my $prefix = defined($ARGV[1]) ? $ARGV[1] : ""; ## Download the HTML code from the YouTube page my $html = `wget -Ncq -e "convert-links=off" --keep-session-cookies --save-cookies /dev/null --no-check-certificate "$url" -O-` or die "nThere was a problem downloading the HTML file.nn"; ## Collect the title of the page to use as the file name my ($title) = $html =~ m/<title>(.+)</title>/si; $title =~ s/[^wd]+/_/g; $title =~ s/_youtube//ig; $title =~ s/^_//ig; $title = lc ($title); ## Collect the URL of the video my ($download) = $html =~ /"url_encoded_fmt_stream_map"([sS]+?),/ig; ## Clean up the URL by translating Unicode and removing unwanted strings $download =~ s/: "//; $download =~ s/%3A/:/g; $download =~ s/%2F///g; $download =~ s/%3F/?/g; $download =~ s/%3D/=/g; $download =~ s/%252C/%2C/g; $download =~ s/%26/&/g; $download =~ s/sig=/signature=/g; $download =~ s/\u0026/&/g; $download =~ s/(type=[^&]+)//g; $download =~ s/(fallback_host=[^&]+)//g; $download =~ s/(quality=[^&]+)//g; ## Collect the URL and signature since the HTML page randomizes the order my ($signature) = $download =~ /(signature=[^&]+)/; my ($youtubeurl) = $download =~ /(http.+)/; $youtubeurl =~ s/&signature.+$//; ## Combine the URL and signature in order to use in Wget $download = "$youtubeurl&$signature"; ## A bit more cleanup $download =~ s/&+/&/g; $download =~ s/&itag=d+&signature=/&signature=/g; ## Print the file name of the video collected from the web page title for us to see on the CLI print "n Download: $prefix$title.webmnn"; ## Download the file using Wget and background the Wget process system("wget -Ncq -e "convert-links=off" --load-cookies /dev/null --tries=50 --timeout=45 --no-check-certificate "$download" -O $prefix$title.webm &"); #### EOF #####

这是我已经使用了一段时间的Perl脚本。 我不确定它是从哪里来的…它工作的很好。

我会推荐youtube-dl作为来自YouTube和其他视频网站的控制台下载程序。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐