🐍Python依云's BlogContent type: Blog

通过字幕总结YouTube视频内容 (opens in new tab)

本文来自,转载请注明。 现在YouTube首页的视频推荐越来越差了,好多标题党、clickbait,故意把讨论的主题藏起来。经常我点进去看了好久,才发现原来并没有讨论什么我之前不知道信息,又或者讨论的话题我完全不感兴趣。再不就是把我想知道的信息藏到不知道哪个片段里。虽然我有 正好最近在尝试Gemini API,于是灵光一现,写了个脚本,使用 #!/usr/bin/python3 import sys import json import subprocess import tempfile from pathlib import Path import httpx GEMINI_KEY = 'YOUR GEMINI KEY HERE' URL = ' PROMPT = '根据以下字幕文本总结视频内容。总结结果中请不要包含任何赞助商推广信息。' def main(url, sublang): with tempfile.TemporaryDirectory() as d: subprocess.run([ 'yt-dlp', '--sub-langs', sublang, '--w...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help