Reputation: 1039
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
Upvotes: 2
Views: 424
Reputation: 8511
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
Upvotes: 2
Reputation: 43870
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.
Upvotes: 2