22.07.2023

8

Beğenme

2520

Görüntülenme

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

Yorumlar

Kullanıcı yorumlarını görüntüleyebilmek için kayıt olmalısınız!

Emir Efetürk

Konum

Hatay, TR

© 2021 Patika Dev

facebook
twitter
instagram
youtube
linkedin

Disclaimer: The information /programs / events provided on https://patika.dev and https://risein.com are strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice and do not make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://patika.dev and https://risein.com disclaim any responsibility for financial decisions made by users based on information provided here.