you-get:一行命令下载视频和Python简单使用you-get

Posted 编程爱好者-阿新

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了you-get:一行命令下载视频和Python简单使用you-get相关的知识,希望对你有一定的参考价值。

you-get:一行命令下载视频和Python简单使用you-get

1、安装you-get库

安装you-get库如下所示

(spider) E:\\Document\\Video\\you-get_Video\\BLACKPINK>pip install you-get
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting you-get
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a3/90/29332796e5248a37caae04e50564dcfad183b77f5143339dffa14791b425/you_get-0.4.1620-py3-none-any.whl (230 kB)
Installing collected packages: you-get
Successfully installed you-get-0.4.1620

2、you-get库的使用

2.1、下载命令:you-get+URL

一般的you-get 下载命令如下所示

you-get  URL

例如:you-get https://www.bilibili.com/video/BV13V41117xc?spm_id_from=333.337.search-card.all.click

  • 效果如下:
(spider) E:\\Document\\Video\\you-get_Video\\BLACKPINK>you-get  https://www.bilibili.com/video/BV13V41117xc?spm_id_from=333.337.search-card.all.click
you-get: This is a multipart video. (use --playlist to download all parts.)
site:                Bilibili
title:               【计算机导论】计算机科学导论(大神之路-起始篇) (P1. 0.起始篇)
stream:
    - format:        flv
      container:     flv
      quality:       高清 1080P
      size:          18.3 MiB (19184674 bytes)
    # download-with: you-get --format=flv [URL]

Downloading 【计算机导论】计算机科学导论(大神之路-起始篇) (P1. 0.起始篇).flv ...
 6.8% (  1.2/ 18.3MB) ├███─────────────────────────────────────┤[1/1]  122 kB/s

2.2、下载命令:-l

下载命令:-l使用如下所示。
例如

you-get -i https://www.bilibili.com/video/BV1vx411p7yn?spm_id_from=333.337.search-card.all.click&vd_source=e3ed038abbffc416fc9c30fc99037706
  • 效果如下所示。
  • 运行的代码如下所示。
(spider) C:\\WINDOWS\\system32>you-get -i https://www.bilibili.com/video/BV1vx411p7yn?spm_id_from=333.337.search-card.all.click&vd_source=e3ed038abbffc416fc9c30fc99037706
you-get: This is a multipart video. (use --playlist to download all parts.)
site:                Bilibili
title:               【BLACKPINK】BLACKPINK综艺合集(更新至181221《美里秋》) (P1. 181221【美里秋】EP.6)
streams:             # Available quality and codecs
    [ DASH ] ____________________________________
    - format:        dash-flv720
      container:     mp4
      quality:       高清 720P
      size:          1083.5 MiB (1136105582 bytes)
    # download-with: you-get --format=dash-flv720 [URL]

    - format:        dash-flv480
      container:     mp4
      quality:       清晰 480P
      size:          608.6 MiB (638169151 bytes)
    # download-with: you-get --format=dash-flv480 [URL]

    - format:        dash-flv360
      container:     mp4
      quality:       流畅 360P
      size:          222.2 MiB (233020094 bytes)
    # download-with: you-get --format=dash-flv360 [URL]

    [ DEFAULT ] _________________________________
    - format:        flv720
      container:     flv
      quality:       高清 720P
      size:          1108.4 MiB (1162269877 bytes)
    # download-with: you-get --format=flv720 [URL]

    - format:        flv480
      container:     flv
      quality:       清晰 480P
      size:          492.3 MiB (516196104 bytes)
    # download-with: you-get --format=flv480 [URL]

    - format:        flv360
      container:     flv
      quality:       流畅 360P
      size:          302.0 MiB (316714843 bytes)
    # download-with: you-get --format=flv360 [URL]

  • 可以看到视频的下载信息。
  • 视频具有下载信息的格式。

3、通过python 使用you-get


import sys
import you_get


def VideoDownloads(url, path):
    sys.argv = ['you-get', '-o', path, url]
    you_get.main()


if __name__ == '__main__':
    # 视频网站的地址
    url = 'https://www.bilibili.com/video/BV13V41117xc?spm_id_from=333.337.search-card.all.click'
    # 视频输出的位置
    path = 'E:\\\\Document\\\\Video\\\\you-get_Video'
    VideoDownloads(url, path)
    

运行结果如下:

以上是关于you-get:一行命令下载视频和Python简单使用you-get的主要内容,如果未能解决你的问题,请参考以下文章

命令行视频下载工具you-get和youtube-dl

python you-get 下载视频

you-get下载b站视频

you-get下载b站视频

python you-get包怎么在win系统上用

you-get 视频爬取