[Mac] 使用 youtube-dl 工具,下載 B 站的影片檔並轉成 MP3

[Mac] 使用 youtube-dl 工具,下載 B 站的影片檔並轉成 MP3

之前寫過一篇 使用 youtube-dl 工具下載 Youtube 影片/MP3

今天想用它來抓 B 站 (BiliBili) 的影片/Mp3,

結果遇到了錯誤訊息,說 Unable to extract player parameters:

testuser@localhost ~ $ youtube-dl --extract-audio --audio-format mp3 --no-playlist 'https://www.bilibili.com/video/av22726601'

[BiliBili] 22726601: Downloading webpage
ERROR: Unable to extract player parameters; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

 

本來也不知道要怎麼解決,

不過在另外一台 Mac 上,youtube-dl 卻能成功抓下 B 站的影片與 MP3…

對比一下,想到應該是 youtube-dl 或相關套件版本的問題。

先將 Homebrew 更新一下:

brew update & brew upgrade

 

youtube-dl 從 2018-3 版本更新成了 2018-4 版本,ffmpeg 的版本也有更新。

這時再執行一次 youtube-dl,就能成功抓下 B 站的影片,也能轉成音訊 MP3 了:

testuser@localhost ~ $ youtube-dl --extract-audio --audio-format mp3 --no-playlist 'https://www.bilibili.com/video/av22726601'

[BiliBili] 22726601: Downloading webpage
[BiliBili] 22726601: Downloading video info page
[download] 【排骨】一眼旧梦-22726601.flv has already been downloaded
[download] 100% of 67.02MiB
[ffmpeg] Destination: 【排骨】一眼旧梦-22726601.mp3
Deleting original file 【排骨】一眼旧梦-22726601.flv (pass -k to keep)

 

如果只要抓下影片,不要轉成音訊 MP3 的話,

就不要加上 –extract-audio –audio-format mp3 參數就行囉:

youtube-dl --no-playlist 'https://www.bilibili.com/video/av22726601'

 

有了 youtube-dl 這好工具,真的是太方便啦~

 


2018/05/27 備註:網友留言說無法抓下某個影片,

試了一下,出現了 ffprobe or avprobe not found 的錯誤訊息:

testuser@localhost ~ $ youtube-dl --no-playlist 'https://www.bilibili.com/video/av16374288/?p=1'

[BiliBili] 16374288: Downloading webpage
[BiliBili] 16374288: Downloading video info page
[download] Destination: 【安室奈美惠】95-17PV合辑 (已更新Magical Christmas)-16374288.flv
[download] 100% of 61.66MiB in 02:08
ERROR: ffprobe or avprobe not found. Please install one.

 

嗯… 之前已經裝過 ffmpeg 套件,Homebrew 也更新過,

看來應該是 ffmpeg (ffprobe) 沒辦法成功轉檔…

avprobe 看來是在另一個套件 libav 裡面,就來安裝 libav 看看:

brew install libav

 

再重新下載影片,這次就成功完成啦:

testuser@localhost ~ $ youtube-dl --no-playlist 'https://www.bilibili.com/video/av16374288/?p=1'

[BiliBili] 16374288: Downloading webpage
[BiliBili] 16374288: Downloading video info page
[download] 【安室奈美惠】95-17PV合辑 (已更新Magical Christmas)-16374288.flv has already been downloaded
[download] 100% of 61.66MiB
[ffmpeg] Destination: 【安室奈美惠】95-17PV合辑 (已更新Magical Christmas)-16374288.mp3
Deleting original file 【安室奈美惠】95-17PV合辑 (已更新Magical Christmas)-16374288.flv (pass -k to keep)

 

如果是 Windows 系統上的話,應該是可以到 libav 下載區

找找看 Windows build 來安裝囉 (個人沒試過)~

(本頁面已被瀏覽過 8,061 次)

4 thoughts on “[Mac] 使用 youtube-dl 工具,下載 B 站的影片檔並轉成 MP3

    1. 試了一下,如果安裝 libav,
      在 Mac 上就能成功抓下影片了~
      麻煩您在 Windows 上試試看囉,謝謝~
      (文章內容有更新,可以參考一下)

      1. 版主您好~可以下載了~但像上面那個網頁是使用撥放清單的方式,我下載下來都是第一首的影片,您是可以下載全部嗎~?

        1. 不要加上 –no-playlist,
          就可以下載播放清單中的所有影片囉~

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料