0


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 (19184674bytes)# 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 (1136105582bytes)# download-with: you-get --format=dash-flv720 [URL]-format:        dash-flv480
      container:     mp4
      quality:       清晰 480P
      size:608.6 MiB (638169151bytes)# download-with: you-get --format=dash-flv480 [URL]-format:        dash-flv360
      container:     mp4
      quality:       流畅 360P
      size:222.2 MiB (233020094bytes)# download-with: you-get --format=dash-flv360 [URL][ DEFAULT ] _________________________________
    -format:        flv720
      container:     flv
      quality:       高清 720P
      size:1108.4 MiB (1162269877bytes)# download-with: you-get --format=flv720 [URL]-format:        flv480
      container:     flv
      quality:       清晰 480P
      size:492.3 MiB (516196104bytes)# download-with: you-get --format=flv480 [URL]-format:        flv360
      container:     flv
      quality:       流畅 360P
      size:302.0 MiB (316714843bytes)# download-with: you-get --format=flv360 [URL]
  • 可以看到视频的下载信息。
  • 视频具有下载信息的格式。

3、通过python 使用you-get

import sys
import you_get

defVideoDownloads(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)

运行结果如下:
在这里插入图片描述


本文转载自: https://blog.csdn.net/m0_47419053/article/details/126679490
版权归原作者 编程爱好者-阿新 所有, 如有侵权,请联系我们删除。

“you-get:一行命令下载视频和Python简单使用you-get”的评论:

还没有评论