mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
21 lines
526 B
Python
21 lines
526 B
Python
import subprocess
|
|
import threading
|
|
|
|
|
|
def download(url, path=".", progress_bar=True, ):
|
|
command = ("ffmpeg", "-y", "-i", "-", "output.wav")
|
|
|
|
content = pytube.YouTube("https://www.youtube.com/watch?v=SE0nYFJ0ZvQ")
|
|
stream = content.streams[0]
|
|
response = urllib.request.urlopen(stream.url)
|
|
|
|
process = subprocess.Popen(command, stdin=subprocess.PIPE)
|
|
|
|
while True:
|
|
chunk = response.read(16 * 1024)
|
|
if not chunk:
|
|
break
|
|
process.stdin.write(chunk)
|
|
|
|
process.stdin.close()
|