KALI下利用PYTHON下载网页视频

我们经常看到一些网站上很精彩的视频,想下载下来长期保存,但网站一般都设了限制,越来越难下载。下面我讲一下在KALI系统之下利用PYTHON库——you-get下载网页视频的方法。

一、接上一篇文章,先安装好PYTHON,然后打开终端,输入代码:sudo pip3 install you-get,回车,但安装失败,出现错误代码;

┌──(hero㉿kali)-[~/桌面]
└─$ sudo pip3 install you-get
[sudo] hero 的密码:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/you-get/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/you-get/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f7fe35a5df0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/you-get/

二、解决以上安装错误的思路为换安装源,输入代码:sudo pip3 install you-get -i http://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.aliyun.com,回车,输入密码,安装成功;

┌──(hero㉿kali)-[~/桌面]
└─$ sudo pip3 install you-get -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
[sudo] hero 的密码:
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting you-get
  Downloading http://mirrors.aliyun.com/pypi/packages/a9/58/382ba8588318b1be53b2de34c136d81c04d2c997bd24c5e5c000d72f74f4/you_get-0.4.1545-py3-none-any.whl (228 kB)
     |████████████████████████████████| 228 kB 3.4 MB/s 
Installing collected packages: you-get
Successfully installed you-get-0.4.1545

三、接下来就可以下载视频了,输入代码:you-get https://www.bilibili.com/video/BV1u44y1x7yq?spm_id_from=333.6.0.0,回车,视频下载后直接保存在桌面了。

┌──(hero㉿kali)-[~/桌面]
└─$ you-get https://www.bilibili.com/video/BV1u44y1x7yq?spm_id_from=333.6.0.0   
site:                Bilibili
title:               水友邮件诉苦毕业两年人生无望 周姐在线痛斥句句真实伤害
stream:
    - format:        flv
      container:     flv
      quality:       高清 1080P
      size:          33.7 MiB (35285590 bytes)
    # download-with: you-get --format=flv [URL]

Downloading 水友邮件诉苦毕业两年人生无望 周姐在线痛斥句句真实伤害.flv ...
 100% ( 33.7/ 33.7MB) ├██████████████████████████████████████████┤[1/1]    9 MB/s

Downloading 水友邮件诉苦毕业两年人生无望 周姐在线痛斥句句真实伤害.cmt.xml ...

作者: 张津东

群而不党,和而不同,自由理性皆容纳。

发表回复