You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取YouTube播放列表视频标题与缩略图并实现自动化(安卓环境)

解决方案汇总

用yt-dlp同时搞定标题和缩略图

你已经在用yt-dlp了,其实它本身就支持抓取缩略图,不用额外找工具,一条命令就能同时导出标题信息、下载缩略图,还能生成结构化的列表。

一次性抓取命令

直接跑下面的命令,会把播放列表里的视频标题、缩略图(或URL)导出,同时把缩略图存到指定文件夹:

yt-dlp -o "thumbnails/%(title)s.%(ext)s" --write-thumbnail --dump-json "你的播放列表URL" > playlist_data.json
  • -o "thumbnails/%(title)s.%(ext)s":指定缩略图的保存路径,用视频标题命名,找起来方便
  • --write-thumbnail:开启缩略图下载功能
  • --dump-json:把视频的所有元数据(标题、缩略图URL、视频ID等)导出成JSON,后续整理列表很方便

要是不想下载图片,只想拿标题和缩略图URL的对应关系,用这个更简单:

yt-dlp --get-title --get-thumbnail "你的播放列表URL" > title_thumb_list.txt

输出的每行就是「标题」和「缩略图URL」,直接能用。

定期自动化执行

不管是Linux/macOS还是安卓(用Termux),都能定时跑脚本:

  1. 先写个脚本文件(比如yt_backup.sh):
#!/bin/bash
PLAYLIST_URL="你的播放列表URL"
BACKUP_DIR="$HOME/youtube_backups"
mkdir -p "$BACKUP_DIR"
yt-dlp -o "$BACKUP_DIR/thumbnails/%(title)s.%(ext)s" --write-thumbnail --dump-json "$PLAYLIST_URL" > "$BACKUP_DIR/playlist_$(date +%Y%m%d).json"
  1. 给脚本加执行权限:chmod +x yt_backup.sh
  2. 设置定时任务:
    • Linux/macOS:输入crontab -e,加一行(比如每天凌晨2点跑):
      0 2 * * * /你的脚本路径/yt_backup.sh
      
    • 安卓用Termux:先装cronie(pkg install cronie),然后同样用crontab设置定时任务就行。

安卓端可用的方案

1. Python脚本(Termux运行)

在Termux里装Python和yt-dlp:

pkg install python ffmpeg
pip install yt-dlp

然后写个简单的Python脚本backup_playlist.py:

import yt_dlp
import json
from datetime import datetime

playlist_url = "你的播放列表URL"
output_dir = "/data/data/com.termux/files/home/youtube_backups"

ydl_opts = {
    'writethumbnail': True,
    'outtmpl': f'{output_dir}/thumbnails/%(title)s.%(ext)s',
}

with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    info_dict = ydl.extract_info(playlist_url, download=True)
    video_list = []
    for entry in info_dict['entries']:
        video_list.append({
            'title': entry['title'],
            'thumbnail_url': entry['thumbnail'],
            'video_id': entry['id']
        })
    # 保存成带日期的JSON文件
    with open(f"{output_dir}/playlist_backup_{datetime.now().strftime('%Y%m%d')}.json", 'w', encoding='utf-8') as f:
        json.dump(video_list, f, ensure_ascii=False, indent=2)

运行脚本:python backup_playlist.py,再配合Termux的cron就能定时自动备份。

2. 安卓APP

  • NewPipe:开源的YouTube客户端,能把播放列表导出成JSON(包含标题和缩略图URL),还能设置自动同步;要是想完全定时,搭配Automate或者Tasker就能实现自动备份。
  • Tasker + yt-dlp:用Tasker创建定时任务,直接调用Termux里的yt-dlp脚本,全程自动不用干预。

3. 本地HTML查看列表

把导出的JSON转成HTML页面,离线就能看带缩略图的标题列表:
写个playlist_viewer.html文件,和JSON放同一文件夹,用浏览器打开就行:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>播放列表备份</title>
    <style>
        .video-item { margin: 10px 0; display: flex; align-items: center; gap: 10px; }
        .video-thumb { width: 120px; height: 90px; object-fit: cover; }
        .video-title { font-size: 14px; max-width: 600px; }
    </style>
</head>
<body>
    <h1>播放列表备份</h1>
    <div id="video-list"></div>

    <script>
        fetch('playlist_data.json') // 替换成你的JSON文件名
            .then(res => res.json())
            .then(data => {
                const list = document.getElementById('video-list');
                data.forEach(video => {
                    const item = document.createElement('div');
                    item.className = 'video-item';
                    item.innerHTML = `
                        <img src="${video.thumbnail}" class="video-thumb" alt="${video.title}">
                        <div class="video-title">${video.title}</div>
                    `;
                    list.appendChild(item);
                });
            });
    </script>
</body>
</html>

内容的提问来源于stack exchange,提问作者Ragib Rownak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 18:35:51