<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>下載 YouTube &#8211; electrify.tw</title>
	<atom:link href="https://electrify.tw/tag/%E4%B8%8B%E8%BC%89-youtube/feed/" rel="self" type="application/rss+xml" />
	<link>https://electrify.tw</link>
	<description>電動車・人工智慧・永續能源</description>
	<lastBuildDate>Sat, 29 Mar 2025 04:04:46 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://electrify.tw/wp-content/uploads/2023/02/electrify-favicon.png</url>
	<title>下載 YouTube &#8211; electrify.tw</title>
	<link>https://electrify.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>YouTube 影片縮圖下載工具！全解析度封面版本網址格式對照表</title>
		<link>https://electrify.tw/youtube-thumbnail-downloader/</link>
		
		<dc:creator><![CDATA[electrify.tw]]></dc:creator>
		<pubDate>Mon, 27 Feb 2023 04:00:11 +0000</pubDate>
				<category><![CDATA[網路資源]]></category>
		<category><![CDATA[電車新聞]]></category>
		<category><![CDATA[YouTube]]></category>
		<category><![CDATA[下載]]></category>
		<category><![CDATA[下載 YouTube]]></category>
		<category><![CDATA[影片]]></category>
		<guid isPermaLink="false">https://electrify.tw/?p=355</guid>

					<description><![CDATA[在現今數位化的時代，YouTube 影片成為人們獲取資訊、娛樂、學習等多方面的重要來源。透過 YouTube  [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><br>在現今數位化的時代，YouTube 影片成為人們獲取資訊、娛樂、學習等多方面的重要來源。透過 <a href="https://developers.google.com/youtube/v3?hl=zh-tw" target="_blank" rel="noreferrer noopener">YouTube Data API</a>，我們可以輕鬆地取得 YouTube 影片的封面、標題、說明、評分等統計資料。</p>



<p>如果只是要下載 YouTube 影片縮圖（封面預覽圖）其實不需要透過 API 就能取得，只要透過特定的網址格式，加上 YouTube 影片的 ID，就能獲取各種尺寸、不同解析度的 YouTube 影片縮圖，讓我們可以根據需要自由選擇。</p>



<h2 class="wp-block-heading">YouTube 影片縮圖下載工具</h2>



<p>如果不想自己拼湊圖片連結來下載 YouTube 影片縮圖，本文為你提供一個更簡單的解決方案。只需要輸入你想要下載的 YouTube 影片網址，然後按下「抓取縮圖」按鈕，選擇你需要的圖片解析度，就能快速下載所需的 YouTube 影片縮圖了。</p>



<div style="background: #f5f5f7; border-radius: 5px; border: 1px solid #eee; padding: 20px; margin-bottom: 1em;">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
        integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <label for="url-input"><b>輸入 YouTube 影片網址</b></label>
    <input style="width: 100%; margin: 10px 0;" type="text" id="url-input">
    <div class="elementor-widget-container">
        <div class="elementor-button-wrapper">
            <a style="color:#fff;text-decoration:none" class="elementor-button-link elementor-button elementor-size-xs"
                role="button" onclick="getThumbnails()">
                抓取縮圖
            </a>
        </div>
    </div>
    <div id="error-message" style="color: red; margin: 10px 0; display: none;"></div>
    <div id="thumbnail-container"></div>
    <script>
        // 添加輸入框按Enter鍵觸發抓取功能
        $('#url-input').keypress(function (e) {
            if (e.which === 13) { // Enter 鍵的 keycode 是 13
                getThumbnails();
            }
        });

        function getThumbnails() {
            // 清除先前的結果
            const thumbnailContainer = $('#thumbnail-container');
            thumbnailContainer.empty();

            // 隱藏錯誤訊息
            $('#error-message').hide();

            // 獲取和驗證 URL
            const urlInput = $('#url-input');
            const videoId = extractVideoId(urlInput.val().trim());

            if (!videoId) {
                $('#error-message').text('請檢查您輸入的 YouTube 影片網址').show();
                return;
            }

            // 如果 URL 有效，顯示縮圖
            const resolutions = [
                { name: 'maxresdefault', label: '解析度 1280×720 的縮圖' },
                { name: 'sddefault', label: '解析度 640×480 的縮圖' },
                { name: 'hqdefault', label: '解析度 480×360 的縮圖' },
                { name: 'mqdefault', label: '解析度 320×180 的縮圖' },
                { name: 'default', label: '解析度 120×90 的縮圖' }
            ];

            for (let i = 0; i < resolutions.length; i++) {
                const thumbnailUrl = `https://img.youtube.com/vi/${videoId}/${resolutions[i].name}.jpg`;

                // 創建縮圖元素
                const thumbnailImage = $('<img>').attr({
                    src: thumbnailUrl,
                    alt: resolutions[i].label,
                    onerror: "this.parentNode.remove()" // 如果圖片載入失敗則移除整個區塊
                });

                const label = $('<h3>').text(resolutions[i].label);

                const downloadLink = $('<br><a style="margin-top:5px;color:#fff;text-decoration:none" class="elementor-button-link elementor-button elementor-size-xs" role="button">').attr({
                    download: `thumbnail-${videoId}-${resolutions[i].name}.jpg`,
                    href: thumbnailUrl,
                    target: '_blank'
                }).text('下載');

                const thumbnailDiv = $('<div>').addClass('thumbnail')
                    .css('margin-bottom', '20px')
                    .append(label, thumbnailImage, downloadLink);

                thumbnailContainer.append(thumbnailDiv);
            }
        }

        function extractVideoId(url) {
            // 處理包含播放列表或時間戳的複雜URL
            url = url.split('&')[0]; // 移除額外參數

            // 支援多種 YouTube URL 格式
            const patterns = [
                /(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/i,
                /(?:https?:\/\/)?(?:www\.)?youtu\.be\/([a-zA-Z0-9_-]{11})/i,
                /(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/i,
                /(?:https?:\/\/)?(?:www\.)?youtube\.com\/v\/([a-zA-Z0-9_-]{11})/i,
                /(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/i
            ];

            for (let pattern of patterns) {
                const match = url.match(pattern);
                if (match && match[1]) {
                    return match[1];
                }
            }

            return '';
        }
    </script>
</div>



<h2 class="wp-block-heading">下載各解析度版本的 YouTube 影片縮圖</h2>



<p>以下整理各個版本的 YouTube 影片縮圖尺寸的標準網址，只要將網址中的 <code>&lt;YouTube影片ID&gt;</code> 替換成你想要的 YouTube 影片 ID，就可以取得該尺寸的影片封面預覽圖。</p>



<p>YouTube 影片網址中的影片 ID：<code>https://www.youtube.com/watch?v=&lt;YouTube影片ID&gt;</code></p>



<p><strong>解析度 120×90 的 YouTube 影片縮圖</strong></p>



<pre class="wp-block-code"><code>https:&#47;&#47;i.ytimg.com/vi/&lt;YouTube影片ID&gt;/default.jpg</code></pre>



<p><strong>解析度 320×180 的 YouTube 影片縮圖</strong></p>



<pre class="wp-block-code"><code>https:&#47;&#47;i.ytimg.com/vi/&lt;YouTube影片ID&gt;/mqdefault.jpg</code></pre>



<p><strong>解析度 480×360 的 YouTube 影片<strong>縮圖</strong></strong></p>



<pre class="wp-block-code"><code>https:&#47;&#47;i.ytimg.com/vi/&lt;YouTube影片ID&gt;/hqdefault.jpg</code></pre>



<p><strong>解析度 640×480 的 YouTube 影片<strong>縮圖</strong></strong></p>



<pre class="wp-block-code"><code>https:&#47;&#47;i.ytimg.com/vi/&lt;YouTube影片ID&gt;/sddefault.jpg</code></pre>



<p><strong>解析度 1280×720 的 YouTube 影片<strong>縮圖</strong></strong></p>



<pre class="wp-block-code"><code>https:&#47;&#47;i.ytimg.com/vi/&lt;YouTube影片ID&gt;/maxresdefault.jpg</code></pre>



<p>希望這篇文章能夠為你提供有用的資訊，如果你對這個工具有任何問題或疑慮，請隨時聯絡我們，也可以查看下方推薦文章。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>如何使用 Homebrew 安裝 youtube-dl 下載 YouTube 跟其他影音網站</title>
		<link>https://electrify.tw/youtube-dl/</link>
		
		<dc:creator><![CDATA[electrify.tw]]></dc:creator>
		<pubDate>Wed, 08 Aug 2018 08:35:16 +0000</pubDate>
				<category><![CDATA[網路資源]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[下載 YouTube]]></category>
		<guid isPermaLink="false">https://electrify.tw/?p=1468</guid>

					<description><![CDATA[線上下載 YouTube 的網站，除了網頁上滿滿的廣告之外，常常會遇到畫質、音質不佳、下載速度慢，或是根本無法 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>線上下載 YouTube 的網站，除了網頁上滿滿的廣告之外，常常會遇到畫質、音質不佳、下載速度慢，或是根本無法正常下載，畢竟 YouTube 隨時在改版，雖然 Google 對於下載 YouTube 這件事算睜一隻眼閉一隻眼，但時不時還是會順手防堵下載的漏洞。</p>



<p>套件 youtube-dl 是在 <a href="https://github.com/rg3/youtube-dl" target="_blank" rel="noopener">GitHub</a> 上公開的開源軟體，透過終端機 CLI 操作，非常輕量、效率極佳，可以完全依照自己想要的畫質、格式來下載 YouTube 影片。</p>



<h2 class="wp-block-heading">下載&nbsp;youtube-dl</h2>



<p>請先安裝 Homebrew，安裝方式可以參考最上方的文章連結。若你已經裝好 Homebrew，則可以透過指令來安裝 youtube-dl，打開終端機並輸入：</p>



<pre class="wp-block-code"><code>brew install youtube-dl</code></pre>



<p>youtube-dl 應該就會自動下載並安裝</p>



<h2 class="wp-block-heading">安裝 ffmpeg</h2>



<p>我們下載 YouTube 影片時可能會用到轉檔、嵌入字幕等功能，這些工作必須交由 ffmpeg 套件來處理。</p>



<pre class="wp-block-code"><code>brew install ffmpeg</code></pre>



<h2 class="wp-block-heading">執行</h2>



<p>如上面所說，youtube-dl 沒有 GUI，而是透過終端機&nbsp;CLI 操作，因此在應用程式資料夾裡是找不到它的，必須使用終端機來操作。</p>



<h2 class="wp-block-heading">選擇影片下載位址</h2>



<p>在 macOS 中，終端機預設目錄是使用者資料夾，路徑是：Macintosh HD &gt; 使用者 &gt; 使用者名稱，這個目錄就如同 Windows 的&nbsp;C:Users使用者名稱</p>



<p>但我們一般下載影片通常不會存在使用者資料夾，因此我們可以先指定下載目錄，例如：下載項目。我們可以在終端機輸入 <code>cd Dow</code> 並按下 tab 鍵，自動帶出完整個目錄名稱 <code>cd Download</code> 再按下 Enter 前往。</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-01.png" alt="" class="wp-image-1969"/></figure>



<h2 class="wp-block-heading">下載影片</h2>



<p>選擇好下載資料夾後，在終端機輸入  youtube-dl &lt;影片網址> 並按 Enter 鍵，預設會選擇影片的最佳畫質和聲音，以 YouTube 第一支影片 <a href="https://www.youtube.com/watch?v=jNQXAC9IVRw" target="_blank" rel="noopener">Me at the zoo</a> 為例，下載指令如下：</p>



<pre class="wp-block-code"><code>youtube-dl https://www.youtube.com/watch?v=jNQXAC9IVRw</code></pre>



<p>按下 Enter 之後 youtube-dl 便開始下載，在沒有設定任何下載選項的狀況下，可以看到這支影片以預設的 WebM 格式下載到下載項目資料夾中。在 YouTube 下載影片，來源的影片檔案可能是各種格式、分段或是影音分開，因此會再自動交由 ffmpeg 將其轉換為單一的影片檔案。</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-02.png" alt="" class="wp-image-1970"/></figure>



<h2 class="wp-block-heading">下載播放清單</h2>



<p>輸入 youtube-dl &lt;播放清單網址> 並按 Enter 鍵，可以下載整個播放清單中所有影片。</p>



<h2 class="wp-block-heading">下載音樂</h2>



<p>輸入 youtube-dl -x &#8211;audio-format mp3 &lt;影片網址> 並按 Enter 鍵，可以下載影片的音訊部分，並轉檔成 mp3 格式。</p>



<h2 class="wp-block-heading">影片轉檔</h2>



<p>剛剛下載的影片是 WebM 格式儲存（有時可能是 mp4 或 mkv 等等）不過其實 WebM 通常用於網頁播放，我們一般在電腦、手機播放或剪輯，其實還是以 mp4 最通用。因此，我們可以在 youtube-dl 下載影片時，在指令後方加入 <code>-f mp4</code> 即可指定下載成 mp4 檔案格式：</p>



<pre class="wp-block-code"><code>youtube-dl https://www.youtube.com/watch?v=jNQXAC9IVRw&nbsp;-f mp4</code></pre>



<p>所以 <code>-f</code> 後面的檔案格式也可以換成 <code>3gp</code>、<code>aac</code>、<code>flv</code>、<code>m4a</code>、<code>mp3</code>、<code>mp4</code>、<code>ogg</code>、<code>wav</code>、<code>webm</code> 等。如果想知道影片有什麼格式（跟畫質選項）可以選擇，只要輸入 youtube-dl -F &lt;影片網址> 並按 Enter 鍵，就會顯示影片的所有可用格式和代碼。</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-03.png" alt="" class="wp-image-1973"/></figure>



<p>下載完成的檔案，以 YouTube 來說，下載的檔案名稱就是&nbsp;<span style="text-decoration: underline;">影片名稱-影片網址的編號.檔案格式</span>。</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-04.png" alt="" class="wp-image-1974"/></figure>



<h2 class="wp-block-heading">嵌入字幕</h2>



<p>有時 YouTube 影片會有不同語言的&nbsp;<a href="https://zh.wikipedia.org/wiki/%E9%9A%B1%E8%97%8F%E5%AD%97%E5%B9%95" target="_blank" rel="noopener">CC 字幕</a>可選擇，我們可以透過&nbsp;youtube-dl 將字幕嵌入到影片中。</p>



<p>首先我們先列出可以下載的字幕，以一日幕僚影片為例，在 youtube-dl 下載指令後方加入 <code>--list-subs</code></p>



<pre class="wp-block-code"><code>youtube-dl https://www.youtube.com/watch?v=Qkf4farak1k --list-subs</code></pre>



<p>youtube-dl 分析 YouTube 網頁後，在最下方 Available subtitles 列出可用的字幕包含：</p>



<ul class="wp-block-list">
<li><span class="s1">zh-CN</span></li>



<li><span class="s1">en</span></li>



<li><span class="s1">zh</span></li>



<li><span class="s1">zh-TW</span></li>
</ul>



<p>也就是簡體中文、英文、中文、中文(台灣)這幾種選擇</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-05.png" alt="" class="wp-image-1978"/></figure>



<p>有關嵌入字幕的 youtube-dl 指令：</p>



<ul class="wp-block-list">
<li><code>--write-sub</code>下載字幕</li>



<li><code>--embed-sub</code>嵌入字幕</li>



<li><code>—-sub-lang zh-TW</code>指定語言（以中文(台灣)為例）</li>



<li><code>--all-subs</code>下載所有字幕（如果要將所有可用的字幕嵌入）</li>
</ul>



<p>因此如果我們要下載嵌入中文(台灣)字幕的 mp4 影片，指令為：</p>



<p><code>youtube-dl <a href="https://www.youtube.com/watch?v=Qkf4farak1k" target="_blank" rel="noopener">https://www.youtube.com/watch?v=Qkf4farak1k</a> --write-sub --embed-sub --sub-lang zh-TW -f mp4</code></p>



<p>支援嵌入字幕的影片格式包含：<code>mp4</code>、<code>mkv</code> 以及 <code>webm</code>；與格式工廠、HandBreak 那種將字幕直接寫入（燒錄？）在影片畫面上的方式不同，使用 youtube-dl 嵌入的字幕是可以選擇開啟或關閉，以及選擇不同語言的。此外，語系的代號大小寫有別，必須一模一樣，例如中文(台灣) <code>zh-TW</code> 的 TW 一定要是大寫，非常重要！</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-06.png" alt="" class="wp-image-1979"/></figure>



<p>下載完成後，以 QuickTime Player 打開，可以看到出現中文字幕的選項；若是以其他播放軟體如 MPlayerX 開啟，應該也是可以選擇字幕的，不過每個軟體顯示情況可能有所不同，例如 MPlayerX 顯示的字幕名稱為 noname [zho]，我們測試時剛好只嵌入一種字幕，所以我們知道是繁體中文；若是嵌入多個字幕語言，可能就會比較難以分辨了。</p>



<figure class="wp-block-image"><img decoding="async" src="https://electrify.tw/wp-content/uploads/2023/04/homebrew-youtube-dl-07.png" alt="" class="wp-image-1980"/></figure>



<h2 class="wp-block-heading">設定下載位置</h2>



<p>使用終端機，預設的目錄應該是「使用者資料夾」，因此若單純使用&nbsp;<code>youtube-dl</code> 加影片網址的指令下載，應該會直接儲存到使用者資料夾中，這邊我們可以建立一個 youtube-dl 的設定檔，來設定預設的下載位置。一樣使用終端機，輸入：</p>



<p><code>mkdir -p ~/.config/youtube-dl</code></p>



<p><code>touch ~/.config/youtube-dl/config</code></p>



<p><code>vi ~/.config/youtube-dl.conf</code></p>



<p>接著按鍵盤&nbsp;<code>i</code> 進入編輯模式，並貼上：</p>



<p><code>--output "/Users/使用者名稱/Downloads/%(title)s.%(ext)s"</code></p>



<p>請記得將使用者名稱替換成 macOS 使用者的目錄名稱。小撇步：可以先輸入 <code>--output "</code> 接著將「下載項目」或你想要的資料夾，拖曳到終端機中，帶入目錄路徑，再貼上 <code>/%(title)s.%(ext)s"</code> 結尾，就可以快速得到正確的路徑了。</p>



<p>接著按鍵盤&nbsp;<code>ESC</code> 退出編輯模式，輸入 <code>:x</code> 再按 ENTER 儲存。</p>



<p>以上這段如果不太理解，可以先 Google 一下「vi 指令」學習一下這個編輯器怎麼使用。</p>



<h2 class="wp-block-heading">替代方案</h2>



<p>筆者在使用 youtube-dl 之餘，偶爾也會使用 Downie 這套付費軟體（包含在 Setapp 的方案中）這套軟體功能也非常強大，支援下載 YouTube 影片以及其他各式各樣的影音網站，包含 Facebook Watch、Instagram Reels、TikTok 跟抖音等等。若對於終端機指令不熟悉或覺得麻煩的朋友，可以試試透過 Downie 來下載。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
