you-get下载B站视频

库存

you-get介绍

https://github.com/soimort/you-get

  • you-get是一个命令行工具,可以下载知名网站的视频

  • 支持的网站有

     https://github.com/soimort/you-get#supported-sites
    • B站、优酷、iqiyi等号称都支持(未测试)

you-get安装

  • pip安装即可

     pip install you-get
  • 安装完毕可以在python主目录下看到you-get.exe

B站视频下载

若有侵权,联系删除

单个视频

  • 以计算机速成课:https://www.bilibili.com/video/BV1EW411u7th?p=1,为例

  • 我们打开命令行就可以直接下载该视频

      you-get https://www.bilibili.com/video/BV1EW411u7th?p=1
     you-get: This is a multipart video. (use --playlist to download all parts.)
     site:               Bilibili
     title:               【计算机科学速成课】[40集全/精校] - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Computing)
     stream:
         - format:       dash-flv
          container:     mp4
          quality:       高清 1080P
          size:          95.9 MiB (100564888 bytes)
         # download-with: you-get --format=dash-flv [URL]
     ​
     Downloading 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.mp4 ...
      100% ( 95.9/ 95.9MB) ├████████████████████████████████████████┤[2/2]    9 MB/s
     Merging video parts... Merged into 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.mp4
     ​
     Downloading 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.cmt.xml ...
  • 观察输出信息,可以看到我们下载了1个视频,还有xml文件

  • 如果不需要xml

      you-get --playlist --no-caption https://www.bilibili.com/video/BV1EW411u7th?p=1

系列视频

所谓的系列视频就是尾部的?p=1是连续的

以前没有这个参数的时候我还写了个python代码封装了下,现在直接就用参数搞定了。

  • 头部有个提示非常重要:This is a multipart video. (use --playlist to download all parts.)

  • 我们可以使用命令下载所有该系列的视频

      you-get --playlist https://www.bilibili.com/video/BV1EW411u7th?p=1

视频列表

  • 比如码农高天的《不基础的python基础》

     https://www.bilibili.com/video/BV1ju411z7Sy/?spm_id_from=333.788&vd_source=d61c58dca32c5d3ac2ed193c3abdd530
    • 目前没想到好的办法处理

附录:命令行参数

  • 你可以忽略这部分

  • 参数可以通过you-get --help得到,常用的并不多。

    • -O FILE 输出到指定文件名

    • -o DIR 输出到某个目录下

 Download options:
  -n, --no-merge       Do not merge video parts
  --no-caption         Do not download captions (subtitles, lyrics, danmaku, ...)
  --postfix             Postfix downloaded files with unique identifiers
  -f, --force           Force overwriting existing files
  --skip-existing-file-size-check
                        Skip existing file without checking file size
  -F STREAM_ID, --format STREAM_ID
                        Set video format to STREAM_ID
  -O FILE, --output-filename FILE
                        Set output filename
  -o DIR, --output-dir DIR
                        Set output directory
  -p PLAYER, --player PLAYER
                        Stream extracted URL to a PLAYER
  -c COOKIES_FILE, --cookies COOKIES_FILE
                        Load cookies.txt or cookies.sqlite
  -t SECONDS, --timeout SECONDS
                        Set socket timeout
  -d, --debug           Show traceback and other debug info
  -I FILE, --input-file FILE
                        Read non-playlist URLs from FILE
  -P PASSWORD, --password PASSWORD
                        Set video visit password to PASSWORD
  -l, --playlist       Prefer to download a playlist
  -a, --auto-rename     Auto rename same name different files
  -k, --insecure       ignore ssl errors
  -m, --m3u8           download video using an m3u8 url
 ​
 Playlist optional options:
  --first FIRST         the first number
  --last LAST           the last number
  --size PAGE_SIZE, --page-size PAGE_SIZE
                        the page size number
 ​
 Proxy options:
  -x HOST:PORT, --http-proxy HOST:PORT
                        Use an HTTP proxy for downloading
  -y HOST:PORT, --extractor-proxy HOST:PORT
                        Use an HTTP proxy for extracting only
  --no-proxy           Never use a proxy
  -s HOST:PORT or USERNAME:PASSWORD@HOST:PORT, --socks-proxy HOST:PORT or USERNAME:PASSWORD@HOST:PORT
                        Use an SOCKS5 proxy for downloading
 

最新文章

  1. java代码走查审查规范
  2. Python模块之configpraser
  3. 衣明志是个SB
  4. 网络HTTP、JSON、XML解析等 复习
  5. python 元组问题解决
  6. ISAP
  7. Android中的一些基础知识(三)
  8. android端向服务器提交请求的几种方式
  9. The Movie db (TMDB)的API申请
  10. Spring Boot:Consider defining a bean of type '*.*.*' in your configuration解决方案
  11. Ambari部署HDP:HBase Master启动后自动消失
  12. nodefs模块的使用demo
  13. eclipse core expression usage
  14. maven settings.xml配置优化
  15. linux下安装lnmp环境
  16. OC 构造方法(对象初始化)
  17. Beta周王者荣耀交流协会第一次Scrum会议
  18. Android逆向之旅---带你爆破一款应用的签名验证问题
  19. cocos2d-x v3.0新特性及使用
  20. Sql Server 2008R2 数据库发布与订阅

热门文章

  1. win10 优化
  2. 嵌入式-C语言基础:二维数组
  3. mysql管理工具mysqladmin的使用
  4. 1、ArrayList源码解析
  5. 关于解决Failed on cp file to /system - Cross-device link 报错
  6. 关于tomcat8在windows2008下高并发下有关问题的解决方案
  7. 【每日一题】【判断栈是否为空的方法】2022年1月9日-NC76 用两个栈实现队列的出队入队【入队简单】
  8. Burp Suite
  9. MySQL事务(四大特性)-存储过程
  10. docker-compose + mysql8.x 主从数据库配置