nbweb
V2EX  ›  问与答

youtube-dl 下载的视频名字后面一串字符如何去掉?

  •  
  •   nbweb · Aug 7, 2021 · 2839 views
    This topic created in 1918 days ago, the information mentioned may be changed or developed.
    1 、长度和时间的测量-iUrUu-In0BA.mp4
    6 、温度与温度计-6UzYoZvqxXE.mp4

    类似这样的,-后面这一串,怎么去掉?是在 debian 里面下载的

    youtube-dl -f 140+251 url,这种方式来下载的。
    12 replies  •  2021-08-08 04:40:51 +08:00
    JustSong
    JustSong
    Aug 7, 2021 via Android
    1
    去文档找有没有配置项呗
    ruixue
    ruixue
    Aug 7, 2021❤️2
    2
    -o '%(title)s.%(ext)s'
    40EaE5uJO3Xt1VVa
    40EaE5uJO3Xt1VVa
    Aug 7, 2021
    4
    我之前下载好了写了个脚本自动匹配重命名,脚本找不到了,你看着写写,也不难
    yanyumihuang
    yanyumihuang
    Aug 7, 2021 via Android
    5
    rename,命令
    emonc
    emonc
    Aug 7, 2021
    6
    可以直接配置 youtube-dl.conf 把上面那个参数写进去
    matrix67
    matrix67
    Aug 7, 2021
    7
    rename 's/\-.*mp4/\.mp4/' *.mp4
    matrix67
    matrix67
    Aug 7, 2021
    8
    测试可以使用:

    qqq@admin:/tmp/test# touch 长度和时间的测量-iUrUu-In0BA.mp4
    qqq@admin:/tmp/test# touch 温度与温度计-6UzYoZvqxXE.mp4
    qqq@admin:/tmp/test# ls
    温度与温度计-6UzYoZvqxXE.mp4 长度和时间的测量-iUrUu-In0BA.mp4
    qqq@admin:/tmp/test# rename 's/\-.*mp4/\.mp4/' *.mp4
    qqq@admin:/tmp/test# ls
    温度与温度计.mp4 长度和时间的测量.mp4
    msg7086
    msg7086
    Aug 7, 2021
    9
    @matrix67 你这么写的话,如果标题里有横线就会删掉多余的字符吧。
    matrix67
    matrix67
    Aug 7, 2021
    10
    @msg7086 #9 确实。这个只能具体问题具体分析了。😂
    PbCopy111
    PbCopy111
    Aug 7, 2021❤️1
    11
    youtube-dl -o"%(playlist_index)s-%(title)s.%(ext)s"

    或者最后添加-A 自动加数字列表进去
    cathedrel
    cathedrel
    Aug 8, 2021
    12
    那一串字符不是没意义的,它就是 youtube 的视频 ID,“www.youtube.com/watch?v=”后面加上那一窜字符就可以网页上打开该视频
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   692 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 20:01 · PVG 04:01 · LAX 12:01 · JFK 15:01
    ♥ Do have faith in what you're doing.