文章目錄
- 一、簡介
- 二、安裝
- 三、下載B站視頻
- 四、下載其他網站視頻
- 1. 優酷短視頻
- 2. 騰訊短視頻
- 3. 央視網視頻
- 4. 鳳凰網視頻
- 5. 爆米花視頻
- 6. 搜狐視頻
一、簡介
You-Get 乃一小小噠命令列程式,提供便利的方式來下載網路上的媒體資訊,
為什么你要好好的用you-get:
- 你歡喜于互聯網上的富媒體內容,并為個人尋歡而儲存
- 你喜悅觀看的視頻,然而不得保存;對個人設備無從控制,此乃違背開放互聯網之行為
- 你尋求解脫于閉源軟體或 JavaScript 代碼,并禁止 Flash 運行
- 你為黑客精神與自由軟體而欣喜
you-get大法之功用:
- 下載流行網站之音視頻,例如YouTube、Youku、TED、土豆以及更多
- 于您心儀的媒體播放器中觀看在線視頻,脫離瀏覽器與廣告
- 下載您喜歡的網頁上的圖片
- 下載任何非HTML內容,例如二進制檔案
官方檔案傳送門:https://github.com/soimort/you-get/wiki/%E4%B8%AD%E6%96%87%E8%AF%B4%E6%98%8E
二、安裝
you-get的官方版本通過 PyPI 分發, 可從 PyPI 鏡像中通過 pip 包管理器進行安裝:
pip install you-get -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
官方檔案中強烈推薦安裝上FFmpeg,下載鏈接如下:
FFmpeg下載鏈接:https://www.ffmpeg.org/download.html

下載到本地后,配置環境變數,在命令列能正常使用,說明安裝成功,
三、下載B站視頻
以下載小姐姐跳舞視頻為例:

當觀賞感興趣的視頻時,您可以使用 --info/-i 以查看所有可用畫質與格式:

- 標有 DEFAULT 為默認畫質,如果希望保存為其他格式(mp4),可以使用 -i 查看所有可用畫質與格式給出的其他選項進行下載
- 使用其他選項進行下載:download-with(之后的):you-get --format=,,, URL
- 使用 --output-dir/-o 設定路徑,–output-filename/-O 設定輸出檔案名
- 下載程序中可以使用 Ctrl+C 暫停下載
you-get -o D:\test --format=dash-flv https://www.bilibili.com/video/BV1me411W7J5


速度嗖嗖的,視頻下載到了本地我們設定的路徑下:

Nice,小五感覺很不錯,但上面那種方法下載這個視頻,視頻和音頻分開了,我們可以換一種格式選項再下載:
# 視頻音頻在一塊兒
you-get -o D:\test --format=flv https://www.bilibili.com/video/BV1me411W7J5
在 Python 中使用:
# -*- coding: UTF-8 -*-
"""
@File :demo1.py
@Author :葉庭云
@CSDN :https://yetingyun.blog.csdn.net/
"""
import sys
from you_get import common as you_get # 匯入you-get庫
# 設定下載目錄
directory = r'D:\test'
# 要下載的視頻地址
url = 'https://www.bilibili.com/video/BV1me411W7J5'
# 傳引數
sys.argv = ['you-get', '-o', directory, '--format=flv', url]
you_get.main()

下面舉例下載整個視頻選集,【老友記第一季】全網最硬核美劇學習筆記丨英語口語丨英語聽力丨背單詞,
you-get -o D:\test --playlist https://www.bilibili.com/video/BV1RE411C7t5?from=search&seid=12600458593644846501

運行效果如下:

可用的引數:
usage: you-get [OPTION]... URL...
A tiny downloader that scrapes the web
optional arguments:
-V, --version Print version and exit
-h, --help Print this help message and exit
Dry-run options:
(no actual downloading)
-i, --info Print extracted information
-u, --url Print extracted information with URLs
--json Print extracted URLs in JSON format
Download options:
-n, --no-merge Do not merge video parts
--no-caption Do not download captions (subtitles, lyrics, danmaku,
...)
-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
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
支持網站如下:





那么好的工具,當然用來學習和收藏喜歡的視頻再合適不過了,
注意:
- 如果 you-get 出現問題,不要驚慌. (是的,問題一直存在!),看看是不是在 https://github.com/soimort/you-get/wiki/Known-Bugs里面,搜索 開放Issue,如果沒人報告,開個新issue,加上詳細的命令列輸出,
- 當然,VIP、付費的那些視頻一般還是下載不了的
- 官網檔案指出:如果你使用本軟體進行盜版行為,或者非法行徑,作者不為你負責,我們僅提供代碼,如何使用請自行考慮,
四、下載其他網站視頻
1. 優酷短視頻
視頻鏈接:https://v.youku.com/v_show/id_XMzczOTU3MjI4OA==.html
you-get -o D:\test https://v.youku.com/v_show/id_XMzczOTU3MjI4OA==.html

2. 騰訊短視頻
電影《神話》中,金喜善山頂跳舞那段,驚艷我許多年!(https://v.qq.com/x/page/y0898b4ah7r.html)
you-get -i https://v.qq.com/x/page/y0898b4ah7r.html
you-get -o D:\test https://v.qq.com/x/page/y0898b4ah7r.html

3. 央視網視頻
視頻鏈接:https://v.cctv.com/2021/01/11/VIDE8Fu1hm5p7teBosh1L0eU210111.shtml?spm=C90324.PE6LRxWJhH5P.EPZudTwNMBDs.1
you-get -o D:\test https://v.cctv.com/2021/01/11/VIDE8Fu1hm5p7teBosh1L0eU210111.shtml?spm=C90324.PE6LRxWJhH5P.EPZudTwNMBDs.1

4. 鳳凰網視頻
視頻鏈接:http://v.ifeng.com/c/82whIiWxH1S
you-get -o D:\test http://v.ifeng.com/c/82whIiWxH1S

5. 爆米花視頻
視頻鏈接:https://video.baomihua.com/v/48815509
you-get -i https://video.baomihua.com/v/48815509
you-get -o D:\test https://video.baomihua.com/v/48815509

6. 搜狐視頻
視頻鏈接:https://tv.sohu.com/v/MjAxNTA5MjcvbjQyMjIxNzc5Ni5zaHRtbA==.html
you-get -o D:\test https://tv.sohu.com/v/MjAxNTA5MjcvbjQyMjIxNzc5Ni5zaHRtbA==.html

搜狐視頻,這個網站用 you-get 下載視頻挺不錯,像電視劇偽裝者也可以直接下載下來,本地打開播放就沒廣告,

經過測驗也發現,以上網站下載效果很好,而有些網站用 you-get 下載視頻會失敗,可能是網路原因或者其他,
作者:葉庭云
CSDN:https://yetingyun.blog.csdn.net/
本文僅用于交流學習,未經作者允許,禁止轉載,更勿做其他用途,違者必究,
覺得文章對你有幫助、讓你有所識訓的話,期待你的點贊呀,不足之處,也可以在評論區多多指正,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/248175.html
標籤:其他
