将 Youtube 上传内容转换为 Podcast

发布于 2024-11-10 15:48:03 字数 116 浏览 3 评论 0原文

有一个 YouTube 频道,每周在同一时间上传一个视频。 是否有可能创建一个 python 脚本来创建一个播客。

我应该学习什么图书馆才能使这件事成为可能,或者它首先是可能的吗?

谢谢

There is this youtube channel that uploads one videos per week at exactly the same time every week.
Is it somewhat possible to create a python script that creates a podcast out of it.

What Library should I be learning to make this thing possible or is it even possible in the first place?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慕巷 2024-11-17 15:48:03

有趣的。有合法的等等权利等等……但你已经知道了。

我认为如果您有一个在页面打开时自动播放的链接,您可以使用 webbrowser< /a>PyAudio 作为简单的撕开方法YouTube 视频中的音频。这需要你玩完整个游戏,并且不考虑游戏时间有多长,但它可能会让你开始。

""" A wire between input and output. """
import pyaudio
import sys
import webbrowser

# open the page
webbrowser.open(AUTOPLAY_URL)

chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format = FORMAT,
            channels = CHANNELS,
            rate = RATE,
            input = True,
            output = True,
            frames_per_buffer = chunk)

print "* recording"
for i in range(0, 44100 / chunk * RECORD_SECONDS):
    data = stream.read(chunk)
    stream.write(data, chunk)
print "* done"

stream.stop_stream()
stream.close()
p.terminate()

这只是 pyaudio 页面的代码。我还没有尝试运行它,但如果你幸运的话它会起作用。

如何打包和提供生成的音频文件是另一个问题。

Interesting. There are legal blah blah blah rights blah blah blah... but you know that already.

I would think if you have a link that auto-plays on page open you could use webbrowser with PyAudio as a simple way to rip the audio from a youtube video. This would require you to play the whole thing and doesn't take into account how long the play time is, but it may get you started.

""" A wire between input and output. """
import pyaudio
import sys
import webbrowser

# open the page
webbrowser.open(AUTOPLAY_URL)

chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format = FORMAT,
            channels = CHANNELS,
            rate = RATE,
            input = True,
            output = True,
            frames_per_buffer = chunk)

print "* recording"
for i in range(0, 44100 / chunk * RECORD_SECONDS):
    data = stream.read(chunk)
    stream.write(data, chunk)
print "* done"

stream.stop_stream()
stream.close()
p.terminate()

This is just code form the pyaudio page. I haven't tried to run it but if your lucky it will work.

How to package and serve the resulting audio file is another issue.

橘虞初梦 2024-11-17 15:48:03

youtube-dl 是一个 Python 脚本,可以下载各种可用格式的 YouTube 电影。如果您安装了 lame mp3 库,它还会为您进行音频转换

youtube-dl is a python script that can download YouTube movies in the various available formats. It will also do the audio conversion for you if you have the lame mp3 library installed

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文