![youtube-dl 參數中的正規表示式](https://rvso.com/image/1654756/youtube-dl%20%E5%8F%83%E6%95%B8%E4%B8%AD%E7%9A%84%E6%AD%A3%E8%A6%8F%E8%A1%A8%E7%A4%BA%E5%BC%8F.png)
我想從 youtube-dl 參數中提取兩個路徑,即輸出模板和 ffmpeg 位置
-o (.*%\(ext\)s).* --ffmpeg-location (.*)
使用上面的正規表示式,我可以從下面的表達式捕獲輸出模板和 ffmpeg 位置
-o D:/Deskttop/test//%(title)s.%(ext)s -i -f (best)[height=1080]/best --recode-video mp4 https://www.youtube.com/watch?v=MMuUFjxLQJU --no-playlist --encoding utf-8 --ffmpeg-location D:/Deskttop/test/
問題是有時未提供 ffmpeg 位置,如下所示:
-o D:/Deskttop/test//%(title)s.%(ext)s -i -f (best)[height=1080]/best --recode-video mp4 https://www.youtube.com/watch?v=MMuUFjxLQJU --no-playlist --encoding utf-8
我希望即使在僅使用一種正規表示式的表達式中不存在 ffmpeg 位置時也能夠捕獲輸出模板。
我正在測試這個這裡。