sungur.dev
Script9 min read

YouTube Downloader - yt-dlp & ffmpeg

yt-dlp ve ffmpeg kurulumlarını kontrol eden, eksikse yönlendiren ve indirme işlemini kolaylaştıran macOS (zsh) ve Windows (.bat) betikleri. Ayrıca sistem gereksinimleri ve indirme linkleri.

YouTube, Instagram, Twitter, Tiktok ve yt-dlp paketinin desteklediği tüm video sitelerinden istediğin içeriği MP3 (ses) veya MP4 (video) formatında içeriğin en yüksek kalitesine göre indirmeni sağlayan iki pratik betik.

Her iki betik de yt-dlp ve ffmpeg araçlarının sistemde kurulu olup olmadığını otomatik kontrol eder, eksikler varsa kurulum talimatlarını ve indirme bağlantılarını gösterir, her şey hazırsa doğrudan indirmeye geçer.

Gerekli araçlar: yt-dlp, ffmpeg

Sistemine göre istediğin betiği belirtilen dosya ismiyle kaydedip çalıştırmaya başladığında, istediğin içeriği, betiğin bulunduğu dizine direkt olarak indirir.

macOS

macOS sisteminde youtube.command dosyasını oluşturduktan sonra çift tıkla çalıştırabilmen için chmod +x youtube.command komutunu çalıştırman gerekiyor.

youtube.command
#!/bin/zsh
# macOS - Özelleştirilmiş & Otomatik Güncellemeli YouTube İndirici
# Dosyayi çift tiklamak icin .command olarak kaydedip: chmod +x youtube.command

set -euo pipefail
clear

# ----- Renk Tanımlamaları -----
BOLD="\033[1m"
GREEN="\033[32m"
BLUE="\033[34m"
CYAN="\033[36m"
YELLOW="\033[33m"
RED="\033[31m"
RESET="\033[0m"

# ----- Başlık Bannerı (Reklam Alanı) -----
echo -e "${BOLD}${CYAN}🔮 ================================================== 🔮"
echo -e "🎬  YOUTUBE INDIRICI (yt-dlp) — macOS"
echo -e "🚀  Developer: @tahsingibi  |  🌐  sungur.dev"
echo -e "🔮 ================================================== ${RESET}"
echo

# ----- Yardimci: bekletme -----
pause() {
    echo -e -n "${YELLOW}⌨️  Devam etmek için bir tuşa basın...${RESET}"
    read -k 1 -s
    echo
}

# ----- Ctrl-C yakalama -----
cleanup() {
    echo
    echo -e "${BOLD}${YELLOW}👋 Görüşmek üzere, çıkış yapılıyor...${RESET}"
    exit 0
}
trap cleanup INT

# ----- Ön Koşullar: komut kontrol -----
need_help=0

if ! command -v yt-dlp >/dev/null 2>&1; then
    echo -e "${RED}❌ yt-dlp bulunamadı.${RESET}"
    echo "  Kurulum Yolları:"
    echo "  - Homebrew:  brew install yt-dlp"
    echo "  - MacPorts:  sudo port install yt-dlp"
    echo "  - Pipx:      pipx install yt-dlp"
    echo
    need_help=1
fi

if ! command -v ffmpeg >/dev/null 2>&1; then
    echo -e "${RED}❌ ffmpeg bulunamadı (Ses/Video birleştirme için şart).${RESET}"
    echo "  Kurulum Yolları:"
    echo "  - Homebrew:  brew install ffmpeg"
    echo
    need_help=1
fi

if [[ $need_help -eq 1 ]]; then
    echo -e -n "${BOLD}${YELLOW}🌐 İndirme sayfalarını tarayıcıda açayım mı? [e/H]: ${RESET}"
    read open_choice
    if [[ "$open_choice" == [eEyY] ]]; then
        command -v open >/dev/null 2>&1 && {
            [[ ! $(command -v yt-dlp) ]] && open "https://github.com/yt-dlp/yt-dlp/releases/latest"
            [[ ! $(command -v ffmpeg) ]] && open "https://www.gyan.dev/ffmpeg/builds/"
        }
    fi
    echo
    echo -e "${RED}Lütfen eksik araçları kurup betiği yeniden çalıştırın.${RESET}"
    pause
    exit 1
fi

# ----- OTOMATİK GÜNCELLEME KONTROLÜ -----
echo -e "${BOLD}${BLUE}🔄 Arka planda yt-dlp güncelleme kontrolü yapılıyor...${RESET}"
if command -v pip &>/dev/null && pip list | grep -q "yt-dlp"; then
    pip install -U yt-dlp --quiet || echo -e "${YELLOW}⚠️ Pip güncellemesi atlandı.${RESET}"
elif command -v brew &>/dev/null && brew list yt-dlp &>/dev/null; then
    brew upgrade yt-dlp --quiet || echo -e "${YELLOW}⚠️ Brew güncellemesi atlandı.${RESET}"
else
    yt-dlp -U >/dev/null 2>&1 || true
fi
echo -e "${GREEN}✨ Sistem güncel ve hazır!${RESET}"
echo -e "${CYAN}--------------------------------------------------${RESET}"

# Çıktı dizini
SCRIPT_DIR="$(cd -- "$(dirname "$0")" && pwd)"

# ----- İndirme Fonksiyonu -----
download_once() {
    local URL FORMAT
    echo
    echo -e "${BOLD}${BLUE}🔗 URL GİRİŞİ${RESET}"
    echo -n "Lütfen indirmek istediğiniz video linkini yapıştırın: "
    read URL
    
    if [[ -z "${URL:-}" ]]; then
        echo -e "${RED}❌ Hata: URL boş bırakılamaz!${RESET}"
        return 1
    fi
    
    echo
    echo -e "${BOLD}${CYAN}🛠️  FORMAT SEÇİMİ${RESET}"
    echo -e "  ${GREEN}[1]${RESET} 🎵  ${BOLD}MP3${RESET} (Yüksek Kalite Ses)"
    echo -e "  ${GREEN}[2]${RESET} 🎥  ${BOLD}MP4${RESET} (4K Destekli/En İyi Video)"
    echo
    echo -n "Seçiminiz (1 veya 2): "
    read FORMAT
    
    echo -e "${CYAN}--------------------------------------------------${RESET}"
    
    case "$FORMAT" in
        1)
            echo -e "${BOLD}${YELLOW}🎧 MP3 Ses dosyası indiriliyor, lütfen bekleyin...${RESET}"
            echo
            yt-dlp \
                -x \
                --audio-format mp3 \
                --audio-quality 0 \
                --no-check-certificates \
                -o "${SCRIPT_DIR}/%(title)s.%(ext)s" \
                "$URL"
            ;;
        2)
            echo -e "${BOLD}${YELLOW}🎞️  En yüksek kalitede video indiriliyor (4K/8K Destekli)...${RESET}"
            echo
            yt-dlp \
                -f "bestvideo+bestaudio/best" \
                --merge-output-format mp4 \
                --no-check-certificates \
                -o "${SCRIPT_DIR}/%(title)s.%(ext)s" \
                "$URL"
            ;;
        *)
            echo -e "${RED}❌ Geçersiz seçim yaptınız!${RESET}"
            return 1
            ;;
    esac
    
    echo
    echo -e "${BOLD}${GREEN}🎉 TEBRİKLER! İndirme başarıyla tamamlandı.${RESET}"
    echo -e "${BLUE}📂 Dosya Konumu:${RESET} ${BOLD}$SCRIPT_DIR${RESET}"
    echo -e "${CYAN}--------------------------------------------------${RESET}"
}

# ----- Ana Döngü -----
while true; do
    if ! download_once; then
        echo -e "${RED}⚠️  İşlem yarıda kesildi veya hata oluştu.${RESET}"
    fi
    
    echo
    echo -e "${BOLD}❓ Ne yapmak istersiniz?${RESET}"
    echo -e "  ${BLUE}[1]${RESET} ➕ Başka bir video indir"
    echo -e "  ${RED}[2]${RESET} 🚪 Uygulamadan çık"
    echo
    echo -n "Seçiminiz (1 veya 2): "
    read NEXT
    
    case "$NEXT" in
        1) clear; echo -e "${BOLD}${CYAN}🔮 Yeni İndirme Başlatılıyor...${RESET}\n"; continue ;;
        2) cleanup ;;
        *) echo -e "${RED}❌ Geçersiz seçim! Çıkış yapılıyor...${RESET}"; cleanup ;;
    esac
done

Windows

youtube.bat
@echo off
setlocal ENABLEDELAYEDEXPANSION
title 🎬 YouTube İndirici (yt-dlp) — @tahsingibi
chcp 65001 >nul
cls

:: ----- Renk Tanımlamaları (ANSI Escape Codes) -----
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do set "ESC=%%b"
set "BOLD=%ESC%[1m"
set "GREEN=%ESC%[32m"
set "BLUE=%ESC%[34m"
set "CYAN=%ESC%[36m"
set "YELLOW=%ESC%[33m"
set "RED=%ESC%[31m"
set "RESET=%ESC%[0m"

:main_loop
cls
:: ----- Başlık Bannerı (Reklam Alanı) -----
echo %BOLD%%CYAN%🔮 ================================================== 🔮%RESET%
echo %BOLD%🎬  YOUTUBE INDIRICI (yt-dlp) — Windows%RESET%
echo %BOLD%🚀  Developer: @tahsingibi  ^|  🌐  sungur.dev%RESET%
echo %BOLD%🔮 ================================================== %RESET%
echo.

:: -------- Ön Koşullar: PowerShell kontrolü --------
where powershell >nul 2>&1
if errorlevel 1 (
  echo %RED%❌ PowerShell bulunamadı. Windows 10/11'de varsayılan olarak gelir.%RESET%
  echo    Alternatif: https://aka.ms/PowerShell
  echo.
  pause
  exit /b 1
)

:: -------- Ön Koşullar: yt-dlp ve ffmpeg kontrolü --------
set "NEED_HELP="

where yt-dlp >nul 2>&1
if errorlevel 1 where yt-dlp.exe >nul 2>&1
if errorlevel 1 (
  echo %RED%❌ yt-dlp bulunamadı.%RESET%
  echo.
  echo    Kurulum Yolları:
  echo    - winget:      winget install -e --id yt-dlp.yt-dlp
  echo    - chocolatey:  choco install yt-dlp
  echo    - Manuel:      https://github.com/yt-dlp/yt-dlp/releases/latest
  echo.
  set "NEED_HELP=1"
)

where ffmpeg >nul 2>&1
if errorlevel 1 (
  echo %RED%❌ ffmpeg bulunamadı (Ses/Video birleştirme için şart).%RESET%
  echo.
  echo    Kurulum Yolları:
  echo    - winget:      winget install -e --id Gyan.FFmpeg
  echo    - Manuel:      https://www.gyan.dev/ffmpeg/builds/
  echo.
  set "NEED_HELP=1"
)

if defined NEED_HELP (
  call :maybeOpenPages
  echo.
  echo %RED%Lütfen eksik araçları kurup betiği yeniden çalıştırın.%RESET%
  pause
  exit /b 1
)

:: ----- OTOMATİK GÜNCELLEME KONTROLÜ -----
echo %BOLD%%BLUE%🔄 Arka planda yt-dlp güncelleme kontrolü yapılıyor...%RESET%
where winget >nul 2>&1
if %errorlevel% equ 0 (
    winget upgrade --id yt-dlp.yt-dlp --quiet >nul 2>&1 || set "SKIP_UP=1"
)
where pip >nul 2>&1
if %errorlevel% equ 0 (
    pip install -U yt-dlp --quiet >nul 2>&1 || set "SKIP_UP=1"
)
yt-dlp -U >nul 2>&1 || rem
echo %GREEN%✨ Sistem güncel ve hazır!%RESET%
echo %CYAN%--------------------------------------------------%RESET%

set "SCRIPT_DIR=%~dp0"

:: -------- İndirme Akışı --------
echo.
echo %BOLD%%BLUE%🔗 URL GİRİŞİ%RESET%
set /p "URL=Lütfen indirmek istediğiniz video linkini yapıştırın: "
if "%URL%"=="" (
    echo.
    echo %RED%❌ Hata: URL boş bırakılamaz!%RESET%
    echo %CYAN%--------------------------------------------------%RESET%
    pause
    goto main_loop
)

echo.
echo %BOLD%%CYAN%🛠️  FORMAT SEÇİMİ%RESET%
echo   %GREEN%[1]%RESET% 🎵  %BOLD%MP3%RESET% (Yüksek Kalite Ses)
echo   %GREEN%[2]%RESET% 🎥  %BOLD%MP4%RESET% (1080p/En İyi Video)
echo.
set /p "FORMAT=Seçiminiz (1 veya 2): "

echo %CYAN%--------------------------------------------------%RESET%

if "%FORMAT%"=="1" (
    echo.
    echo %BOLD%%YELLOW%🎧 MP3 Ses dosyası indiriliyor, lütfen bekleyin...%RESET%
    echo.
    yt-dlp -x --audio-format mp3 --no-check-certificates -o "%SCRIPT_DIR%%%(title)s.%%(ext)s" "%URL%"
    goto done
)

if "%FORMAT%"=="2" (
    echo.
    echo %BOLD%%YELLOW%🎞️  MP4 Video indiriliyor ve optimize ediliyor...%RESET%
    echo.
    yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best" --merge-output-format mp4 --recode-video mp4 --no-check-certificates --postprocessor-args "ffmpeg:-c:v libx264 -c:a aac -strict experimental -b:a 192k -movflags +faststart" -o "%SCRIPT_DIR%%%(title)s.%%(ext)s" "%URL%"
    goto done
)

echo.
echo %RED%❌ Geçersiz seçim yaptınız!%RESET%
echo %CYAN%--------------------------------------------------%RESET%
pause
goto main_loop

:done
echo.
echo %BOLD%%GREEN%🎉 TEBRİKLER! İndirme başarıyla tamamlandı.%RESET%
echo %BLUE%📂 Dosya Konumu:%RESET% %BOLD%%SCRIPT_DIR%%RESET%
echo %CYAN%--------------------------------------------------%RESET%

echo.
echo %BOLD%❓ Ne yapmak istersiniz?%RESET%
echo   %BLUE%[1]%RESET% ➕ Başka bir video indir
echo   %RED%[2]%RESET% 🚪 Uygulamadan çık
echo.
set /p "NEXT=Seçiminiz (1 veya 2): "

if "%NEXT%"=="1" goto main_loop
if "%NEXT%"=="2" goto exit_program
goto exit_program

:exit_program
echo.
echo %BOLD%%YELLOW%👋 Görüşmek üzere, çıkış yapılıyor...%RESET%
timeout /t 2 >nul
exit /b 0

:maybeOpenPages
echo %BOLD%%YELLOW%🌐 İndirme sayfalarını tarayıcıda açayım mı? [E/H]%RESET%
set /p "OPEN=Seçim: "
if /I "%OPEN%"=="E" (
  start "" "https://github.com/yt-dlp/yt-dlp/releases/latest"
  start "" "https://www.gyan.dev/ffmpeg/builds/"
)
exit /b

🚀 Sürüm Notları & Yenilikler

[v1.1.0] - 2026-06-25
  • macOS ve Windows üzerinde yt-dlp aracının kurulu olduğu paket yöneticisi (pip, Homebrew, winget) otomatik taranarak indirme öncesi arka planda sessizce güncellenir; böylece hız kısıtlama ve şifreleme (n-challenge) engelleri aşılır.
  • İnternet kesintisi veya yetki sorunlarında güncelleme adımının betiği çökertmemesi için korumalı hata blokları entegre edildi.
  • Arayüz güncellemesi yapıldı.
  • İndirme tamamlandıktan sonra betiğin doğrudan kapanması engellenerek kullanıcıya yeni bir işlem başlatma veya çıkış yapma esnekliği sunuldu.
  • Olası SSL engellerini ve bağlantı hatalarını ekarte etmek amacıyla tüm yt-dlp sorgularına --no-check-certificates parametresi eklendi.

Command

Search pages, projects, posts and links