Skip to content

Instantly share code, notes, and snippets.

@yuceltoluyag
Created January 3, 2025 02:12
Show Gist options
  • Save yuceltoluyag/ffc839ae88d3253d04fbb00fcc9ee93d to your computer and use it in GitHub Desktop.
Save yuceltoluyag/ffc839ae88d3253d04fbb00fcc9ee93d to your computer and use it in GitHub Desktop.
SoundCloud Playlist Downloader Script

This script allows you to download SoundCloud playlists with the following features:

  • Retry Mechanism: If a download fails, the script will automatically retry up to a specified number of times.
  • Error Notification: If a download fails after the maximum number of retries, the script will notify the user and ask for confirmation to continue.
  • Cancellation Option: The user can choose to cancel the download process at any time.
  • System Event Integration: The script can be integrated with system events for automated downloads (e.g., at a specific time).

Usage

  1. Save the script as download_soundcloud_playlists.sh.
  2. Make the script executable: chmod +x download_soundcloud_playlists.sh.
  3. Run the script: ./download_soundcloud_playlists.sh.

Requirements

  • yt-dlp (will be installed automatically if not present)

Customization

The script can be customized to meet specific needs, such as changing the download directory or adding more playlist URLs.

Contributions

Contributions and suggestions are welcome to improve the script's functionality and usability.

License

This script is provided under the MIT License.

#!/bin/bash
usage() {
echo "Kullanım: $0 [seçenekler]"
echo "-d <dizin> İndirmelerin kaydedileceği dizin yolunu belirtir (varsayılan: \$HOME/Music/ScLikes/)"
echo "-h Bu kullanım talimatlarını gösterir"
exit 1
}
TARGET_DIR="$HOME/Music/ScLikes/"
while getopts "d:h" opt; do
case $opt in
d)
TARGET_DIR="$OPTARG"
;;
h)
usage
;;
\?)
echo "Geçersiz seçenek: -$OPTARG" >&2
usage
;;
esac
done
# Hedef dizin kontrolü ve oluşturma
if [ ! -d "$TARGET_DIR" ]; then
echo "Hedef dizin bulunamadı, oluşturuluyor: $TARGET_DIR"
mkdir -p "$TARGET_DIR"
fi
YTMP3="yt-dlp --cookies-from-browser chrome --download-archive downloaded.txt --no-post-overwrites -ciwx --embed-thumbnail --audio-quality 0 --add-metadata --audio-format mp3 -o '%(title)s.%(ext)s'"
PLAYLISTS=(
"https://soundcloud.com/discover/sets/weekly::yuceltoluyag"
"https://soundcloud.com/discover/sets/new-for-you::yuceltoluyag"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1993314007"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1951497611"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:909328504"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1433791630"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:903974464"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:538784247"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:292412472"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:899318827"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1492318159"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:86822917"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:330391650"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1267338067"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:918625141"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:825946369"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:109699798"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:727235461"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1371704593"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1167325858"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1508230108"
"https://soundcloud.com/discover/sets/personalized-tracks::yuceltoluyag:1948839911"
)
echo "SoundCloud playlist indirme scripti başlatılıyor..."
if ! command -v yt-dlp &> /dev/null; then
echo "yt-dlp komutu bulunamadı, kurulum yapılıyor..."
sudo pacman -S yt-dlp
echo "yt-dlp kurulumu tamamlandı."
fi
cd "$TARGET_DIR" || exit
for PLAYLIST in "${PLAYLISTS[@]}"; do
echo "İndirme başlıyor: $PLAYLIST"
$YTMP3 "$PLAYLIST"
if [ $? -ne 0 ]; then
echo "İndirme başarısız oldu: $PLAYLIST"
else
echo "İndirme tamamlandı: $PLAYLIST"
fi
done
echo "Tüm playlistler indirildi."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment