1. 程式人生 > 實用技巧 >如何在瀏覽器中使用F12工具下載嵌入式視訊

如何在瀏覽器中使用F12工具下載嵌入式視訊

I got an email this week asking how to download some of my Azure Friday video podcast videos from http://friday.azure.com as well as some of the Getting Started Videos from Azure.com.

本週我收到一封電子郵件,詢問如何從http://friday.azure.com下載我的某些Azure Friday視訊播客視訊以及從Azure.com下載一些入門視訊

NOTE: Respect copyright and consider what you’re doing and WHY before you use this technique to download videos that may have been embedded for a reason.

注意:在使用此技術下載可能由於某種原因嵌入的視訊之前,請尊重版權並考慮您的工作狀況和原因。

I told them to download the videos with F12 tools, and they weren't clear how. I'll use an Azure Friday video for the example. Do be aware that there are a ton of ways to embed video on the web and this doesn't get around ones that REALLY don't want to be downloaded. This won't help you with Netflix, Hulu, etc.

我告訴他們使用F12工具下載視訊,但不清楚如何。 我將以Azure星期五視訊為例。 注意,有很多方法可以將視訊嵌入到網路中,而這並不能繞過那些真的不想下載的視訊。 這對Netflix,Hulu等無濟於事。

First, I'll visit the site with the video I want in my browser. I'll use Chrome but this also works in Edge or Firefox with slightly different menus.

首先,我將在瀏覽器中播放想要的視訊,並訪問該網站。 我將使用Chrome,但這在Edge或Firefox中也可以使用,選單略有不同。

Then press F12 to bring up the Developer Tools pane and click Network. In Edge, click Content Type, then Media.

然後按F12彈出“開發人員工具”窗格,然後單擊“網路”。 在“邊緣”中,單擊“內容型別”,然後單擊“媒體”。

Download embedded videos with F12

Click the "clear" button to set up your workspace. That's the International No button there in the Network pane. Now, press Play and get ready.

單擊“清除”按鈕以設定您的工作區。 這是“網路”窗格中的“國際無”按鈕。 現在,按Play並準備。

Look in the Media list for something like ".mp4" or something that looks like the video you want. It'll likely have an HTTP Response in the 20x range.

在“媒體”列表中查詢“ .mp4”之類的內容或類似於您想要的視訊的內容。 它的HTTP響應可能在20倍範圍內。

Download 200

In Chrome, right click on the URL and select Copy as CURL. If you're on Windows pick cmd.exe and bash if you're on Linux/Mac.

在Chrome瀏覽器中,右鍵單擊URL,然後選擇“複製為CURL”。 如果您使用Windows,請選擇cmd.exe,如果使用Linux / Mac,請選擇bash。

Downloading with CURL

You'll get a crazy long command put into your clipboard. It's not all needed but it's a very convenient feature the browser provides, so it's worth using.

您會在剪貼簿中輸入瘋狂的長命令。 並不需要全部,但這是瀏覽器提供的非常方便的功能,因此值得使用。

Get Curl: If you don't have the "curl" command you'll want to download "curl.exe" from here https://curl.haxx.se/dlwiz/ and, if you like, put it in your PATH. If you have Windows, get the free bundled curl version with installer here.

獲取Curl:如果沒有“ curl”命令,則要從此處https://curl.haxx.se/dlwiz/下載“ curl.exe”,如果願意,可以將其放在PATH中。 如果您使用的是Windows,請在此處免費獲取帶有安裝程式的捆綁curl版本

Open a terminal/command prompt - run cmd.exe on Windows - and paste in the command. If the browser you're using only gives you the URL and not the complete "curl" command, the command you're trying to build is basically curl [url] -o [outputfile.mp4]. It's best if you can get the complete command like the one Chrome provides, as it may include authentication cookies or other headers that omitting may prevent your download from working.

開啟終端/命令提示符-在Windows上執行cmd.exe-並貼上命令。 如果您使用的瀏覽器僅提供URL,而不提供完整的“ curl”命令,則您嘗試構建的命令基本上是curl [url] -o [outputfile.mp4]。 最好獲取與Chrome瀏覽器一樣的完整命令,因為它可能包含身份驗證Cookie或其他標頭,如果省略這些標頭,可能會阻止您的下載工作。

GOTCHA: Make sure to remove the -H "Range:" headers (if any) to ensure you get the FULL download and not just a range of bytes!

GOTCHA :確保刪除-H“ Range:”標頭(如果有的話),以確保獲得FULL下載,而不僅僅是位元組範圍!

image

BEFORE you press enter, make sure you add "-o youroutputfilename.mp4." Also, if you can an error about security and certificates, you may need to add "--insecure."

在按Enter鍵之前,請確保新增“ -o youroutputfilename.mp4”。 另外,如果您可能遇到有關安全性和證書的錯誤,則可能需要新增“ --insecure”。

Downloading a streaming video file with CURL

In the screenshot above I'm saving the file as "test.mp4" on my desktop.

在上面的螢幕截圖中,我將檔案另存為“ test.mp4”。

There are several ways to download embedded videos, including a number of online utilities that come and go, but this technique has been very reliable for me.

有幾種下載嵌入式視訊的方法,包括許多線上實用程式,但是這種技術對我來說非常可靠。



Sponsor: Scale your Python for big data & big science with Intel® Distribution for Python. Near-native code speed. Use with NumPy, SciPy & scikit-learn. Get it Today

贊助商:藉助適用於Python的英特爾®發行版,將Python擴充套件到大資料和大科學領域。 接近本機的程式碼速度。 與NumPy,SciPy和scikit-learn一起使用。 立即獲取

關於斯科特(About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·漢塞爾曼(Scott Hanselman)是前教授,前金融首席架構師,現在是演講者,顧問,父親,糖尿病患者和Microsoft員工。 他是一位失敗的單口相聲漫畫家,一個玉米種植者和一本書的作者。

facebook twitter subscribe About 關於 Newsletter 時事通訊 Hosting By 主持人 Hosted in an Azure App Service

翻譯自: https://www.hanselman.com/blog/how-to-download-embedded-videos-with-f12-tools-in-your-browser