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 ...

作者: 張津東

群而不黨,和而不同,自由理性皆容納。

發表回復