22.07.2023

8

Like

1017

Views

Python ile youtube mp3 dönüştürücü

Gereklilikler

-Python 3.x

-Gerekli Python paketleri: pytube, moviepy


from pytube import YouTube
from moviepy.editor import *
import os

def convert_to_mp3(video_url):
try:
# Youtube videosunu çeker
yt = YouTube(video_url)

# Videoyu en yüksek kalitede indirir
video = yt.streams.get_highest_resolution()
video.download()

# İndirilen video dosyasının yolunu ayarlar
video_path = video.default_filename

print(f"Video indirildi: {video_path}")

# Sesi ayıklar ve MP3 olarak kaydeder
mp4_file = video_path
mp3_file = video_path[:-4] + '.mp3'
video = VideoFileClip(mp4_file)
video.audio.write_audiofile(mp3_file)

video.close()
os.remove(mp4_file)

print(f"MP3 dosyası '{mp3_file}' başarıyla oluşturuldu!")

except Exception as e:
print(f"Error: {str(e)}")

# Örnek kullanım
video_url = input("Youtube video URL'si girin: ")
convert_to_mp3(video_url)



Python Temel
Yazılım, Internet, Kodlama ve Konseptleri

Comments

You need to log in to be able to comment!

Emir Efetürk

Location

Hatay, TR

© 2021 Patika Dev

facebook
twitter
instagram
youtube
linkedin