Board logo

标题: 推荐一个 Unix/MAC 下方便的youtube下载器(20楼更新mac装机宝典) [打印本页]

作者: beterhans    时间: 2018-2-19 11:15     标题: 推荐一个 Unix/MAC 下方便的youtube下载器(20楼更新mac装机宝典)

posted by wap, platform: MAC OS X
https://github.com/rg3/youtube-dl

推荐你先安装方法 ffmepg + youtube-dl
推荐使用 homebrew 安装 both

本帖最后由 beterhans 于 2019-7-15 19:53 通过手机版编辑
作者: beterhans    时间: 2018-2-19 11:32

posted by wap, platform: MAC OS X
MAC 安装方法

先安装 Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

在安装 ffmpeg
brew options ffmpeg
brew install ffmpeg --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-libass --with-libbluray --with-libvorbis --with-libvpx --with-tools --with-x265 --with-chromaprint --with-game-music-emu

安装 youtube-dl
brew install youtube-dl

就换自动下载 最高分辩率的MP4视频 并且何并最高音频
+ 说明 + 字幕
生成的 视频文件在 你的 home文件夹下的 Moives / youtube 里

然后吧下面这段话 放在 /etc/youtube-dl.conf



# Lines starting with # are comments

# Always extract audio
#-x

# Do not copy the mtime
#--no-mtime

# Use this proxy
#--proxy 127.0.0.1:3128

# Save all videos under Movies directory in your home directory
-o ~/Movies/youtube/%(uploader)s_%(title)s_%(id)s.%(ext)s

# Download Best MP4
-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'

# Description
--write-description
--write-info-json
--write-annotations

# Subtitle
--all-subs
--sub-format "srt/best"

#
--prefer-ffmpeg
--ffmpeg-location /usr/local/bin/





---END---

使用方法
youtube-dl 网址

就会自动下载到 moives 下了

本帖最后由 beterhans 于 2018-2-19 11:35 通过手机版编辑
作者: jahaman    时间: 2018-2-19 11:56

posted by wap, platform: iPhone
可以下载1080和区域限制的么?
作者: beterhans    时间: 2018-2-19 12:30

posted by wap, platform: iPhone
引用:
原帖由 @jahaman  于 2018-2-19 11:56 发表
可以下载1080和区域限制的么?
区域限制挂VPN落
我的配置文件会自动下载最大分辨率
作者: sfczhw    时间: 2018-2-19 13:52

mark
作者: c1a1i1l1x1    时间: 2018-2-19 14:15

posted by wap, platform: MAC OS X
mk马克
作者: wpang    时间: 2018-2-19 14:16

posted by wap, platform: iPhone
...我推荐个方便易用的吧,macOS上的,Downie,链接拖进去自动跳出全部可选分辨率
作者: beterhans    时间: 2018-2-19 15:07

posted by wap, platform: MAC OS X
引用:
原帖由 @wpang  于 2018-2-19 14:16 发表
...我推荐个方便易用的吧,macOS上的,Downie,链接拖进去自动跳出全部可选分辨率
发现 youtube 一点不好的地方

很多 4K 视频 不给 mp4 格式

mp4 最高的只有 1080p/60FPS
最高分辨率 只有 1440p/30FPS

你要 4K 分辨率 + 60 FPS 只有 WebM 的 VP9 格式
但是无法硬件加速 播放起来卡的要死。
作者: doraamon    时间: 2018-2-19 17:43

posted by wap, platform: Samsung
这么折腾的的方法有什么好处吗?

几乎所有浏览器都有插件可以下。
作者: xykqdy    时间: 2018-2-20 21:36

jdownloader方便多了
作者: somesun    时间: 2018-2-20 21:46

posted by wap, platform: MAC OS X
以前不是有个you-get也不错, 命令行的
作者: cigci    时间: 2018-2-21 00:25

posted by wap, platform: iPhone
Mark P总威武
作者: benquickavon    时间: 2018-2-21 00:32

posted by wap, platform: Android
uc浏览器自带视频下载插件,妥妥的
作者: damnsoul    时间: 2018-3-7 22:13

posted by wap, platform: Firefox
复制youtube-dl.conf到/etc后,在Mac下载会报错,下不了。

Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: no such option: ---END---
作者: beterhans    时间: 2018-3-7 22:18

posted by wap, platform: MAC OS X
引用:
原帖由 @damnsoul  于 2018-3-7 22:13 发表
复制youtubedl.conf到/etc后,在Mac下载会报错,下不了。

Usage: youtubedl  URL

youtubedl: error: no such option: END
没啥问题啊
作者: beterhans    时间: 2018-3-7 22:25

posted by wap, platform: MAC OS X
吧 下面的copy 然后

放入 conf file 里 肯定行的

# Lines starting with # are comments

# Always extract audio
#-x

# Do not copy the mtime
#--no-mtime

# Use this proxy
#--proxy 127.0.0.1:3128

# Save all videos under Movies directory in your home directory
-o ~/Movies/youtube/%(uploader)s_%(title)s_%(id)s.%(ext)s

# Download Best MP4
-f 'bestvideo[ext=mp4][fps>30]+bestaudio[ext=m4a]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'

# Description
--write-description
--write-info-json
--write-annotations

# Subtitle
--all-subs
--sub-format "srt/best"

#
--prefer-ffmpeg
--ffmpeg-location /usr/local/bin/
作者: Pollux_zy    时间: 2019-7-15 16:48

引用:
原帖由 beterhans 于 2018-3-7 22:25 发表
posted by wap, platform: MAC OS X
吧 下面的copy 然后

放入 conf file 里 肯定行的

# Lines starting with # are comments

# Always extract audio
#-x

# Do not copy the mtime
#--no-mtime

# U ...
搞了一下午,貌似都不行
作者: 国家重点型号    时间: 2019-7-15 17:24

posted by wap, platform: MAC OS X
标题有问题。。
Homebrew 是 macOS/Linux 下的包管理器,不支持 FreeBSD / System V 等常见 Unix
作者: beterhans    时间: 2019-7-15 19:46

posted by wap, platform: MAC OS X
引用:
原帖由 @Pollux_zy  于 2019-7-15 16:48 发表
搞了一下午,貌似都不行
我更新了下 可以啊
Last login: Mon Jul 15 19:21:39 on ttys000
MacMini2018:~ hans$ youtube-dl https://www.youtube.com/watch?v=xi__6j-rGhY
[youtube] xi__6j-rGhY: Downloading webpage
[youtube] xi__6j-rGhY: Downloading video info webpage
WARNING: video doesn't have subtitles
[youtube] xi__6j-rGhY: Downloading annotations
[info] Writing video description to: /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.description
[info] Writing video annotations to: /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.annotations.xml
[info] Writing video description metadata as JSON to: /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.info.json
[download] Destination: /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.f136.mp4
[download] 100% of 158.77MiB in 00:07
[download] Destination: /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.f140.m4a
[download] 100% of 14.12MiB in 00:00
[ffmpeg] Merging formats into "/Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.mp4"
Deleting original file /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.f136.mp4 (pass -k to keep)
Deleting original file /Users/hans/Movies/youtube/82电玩大叔_这画面招式,还有手感,可以说是山寨街霸的巅峰了吧_xi__6j-rGhY.f140.m4a (pass -k to keep)
MacMini2018:~ hans$

楼下 Share 下我的装机宝典! 你可以完全参照试试看
作者: beterhans    时间: 2019-7-15 19:52

posted by wap, platform: MAC OS X
Mac 装机宝典 你可以参考下


# Install Xcode command line
xcode-select --install

#------- Install homebrew
--------
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Uninstall homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

# Update list
brew update

# Upgrade everything
brew upgrade

# Or upgrade a specific formula with:
brew upgrade <formula>

# Remove old version of an formula (By default, Homebrew does not uninstall old versions of a formula)
brew cleanup <formula>
or
brew cleanup

# Where does stuff get downloaded?
brew --cache

Search an app
brew search mpv
#will give both cli and gui


brew cask app
#will install gui app


# ------------ Must have apps -----------
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py
pip install --upgrade pip

brew cask install homebrew/cask-versions/adoptopenjdk8

brew install python3
pip3 install --upgrade pip


# --------- Medias ----
# --------- All the base FFMPEG must have others depend on it-------
brew install ffmpeg
brew cask install homebrew/cask/mkvtoolnix


# --------- Youtube downloader must have others depend on it ------
brew install youtube-dl
or
brew update
brew upgrade youtube-dl


# You need to upgrade it every 2-3 month! youtube don't like you to download it's video..
# put following into /etc/youtube-dl.conf
# to enable auto download best mp4 60fps video.

##### START CONFIG FILE
# Lines starting with # are comments

# Always extract audio
#-x

# Do not copy the mtime
#--no-mtime

# Use this proxy
#--proxy 127.0.0.1:3128

# Save all videos under Movies directory in your home directory
-o ~/Movies/youtube/%(uploader)s_%(title)s_%(id)s.%(ext)s

# Download Best MP4
-f 'bestvideo[ext=mp4][fps>30][height <=? 1080]+bestaudio[ext=m4a]/bestvideo[ext=mp4][height <=? 1080]+bestaudio[ext=m4a]/best[ext=mp4]/best'

# Description
--write-description
--write-info-json
--write-annotations

# Subtitle
--all-subs
--sub-format "srt/best"

#
--prefer-ffmpeg
--ffmpeg-location /usr/local/bin/
#### End config file



------- Install Best Mac Media Player mpv and best config --------
brew cask install mpv
# put following config file into /usr/local/etc/mpv/mpv.conf
# to enable best config


### Config Begin
# General
input-media-keys=yes                     # enable/disable OSX media keys

screenshot-format=png
screenshot-png-compression=8
screenshot-template='~/Pictures/%F (%P) %n'

# Video
autofit-larger=100%x90%
autofit-smaller=640x480
framedrop=vo

# Audio
audio-file-auto=fuzzy                                        # external audio doesn't has to match the file name exactly to autoload
audio-pitch-correction=no                                # automatically insert scaletempo when playing with higher speed
volume-max=100                                                        # maximum volume in %, everything above 100 results in amplification
volume=100                                                                # default volume, 100 = unchanged

# OSD
osd-bar-h=1.5
osd-border-size=2
osd-color='#CCFFFFFF'
osd-border-color='#99000000'
osd-duration=2000
osd-font='PingFangSC-Regular'
sub-text-font='PingFangSC-Regular'
# Font pre El Capitan
#osd-font='STHeiti'
#sub-text-font='STHeiti'

# No window border
no-border

# Save the current playback position on quit and resume on next run.
save-position-on-quit

# load config file from file directory, useful for overriding ass styles for entire series
use-filedir-conf=yes

# Subtitles
sub-auto=fuzzy
embeddedfonts=yes                                                # use embedded fonts for SSA/ASS subs
sub-file-paths-append=ass               # search for external subs in these relative subdirectories
sub-file-paths-append=srt
sub-file-paths-append=sub
sub-file-paths-append=subs
sub-file-paths-append=subtitles

# Languages
alang=en,eng,jp,jap,zh,cmn,chi,zho
slang=en,eng,jp,jap,cmn,chi,zho,zh,eng,en

# Youtube
#ytdl
#ytdl-format=best
# Config END




欢迎光临 TGFC Lifestyle (http://bbs.tgfcer.com/) Powered by Discuz! 6.0.0