71 lines
3 KiB
Scheme
71 lines
3 KiB
Scheme
|
#!/usr/bin/guile \
|
||
|
-e main -s
|
||
|
!#
|
||
|
|
||
|
(use-modules (ice-9 format)
|
||
|
(ice-9 popen)
|
||
|
(ice-9 rdelim)
|
||
|
(srfi srfi-1)) ; List library
|
||
|
|
||
|
;; Configuration
|
||
|
(define venv-path (string-append (getenv "HOME") "/.venv/youtube"))
|
||
|
(define yt-dlp-path (string-append venv-path "/bin/yt-dlp"))
|
||
|
|
||
|
;; Function to setup virtual environment and install yt-dlp
|
||
|
(define (setup-environment)
|
||
|
(unless (file-exists? venv-path)
|
||
|
(format #t "Setting up virtual environment...~%")
|
||
|
(system (string-append "python3 -m venv " venv-path))
|
||
|
(system (string-append venv-path "/bin/pip3 install yt-dlp"))))
|
||
|
|
||
|
;; Function to download a playlist
|
||
|
(define (download-playlist playlist-url)
|
||
|
(let ((command
|
||
|
(string-append
|
||
|
yt-dlp-path
|
||
|
" --yes-playlist"
|
||
|
" --prefer-free-formats"
|
||
|
" -N 10"
|
||
|
" -civ"
|
||
|
" -o \"%(channel)s/%(playlist)s/%(playlist_index)s--%(upload_date)s--%(title)s.%(ext)s\""
|
||
|
" \"" playlist-url "\"")))
|
||
|
(system command)))
|
||
|
|
||
|
;; List of playlist URLs
|
||
|
(define playlists
|
||
|
'("https://www.youtube.com/playlist?list=PLRM-PeIcYAz81DzemBOT1SYvAaOBcV8QW"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz85oDXpHVHw1X81oUHrnD8p"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz9-EqL6_UO23SdXQpLL38OP"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz96aLWkjROdfOdl5UKK3265"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz-u3kuc0e8NUfQgSzoxIC86"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz8RQhRvXnR4b-HJFbeCPhDl"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz_c6HbRtpBp9eSlTmW7DN-o"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz8vaEERVVeiOpn5xTWkGD0a"
|
||
|
"https://www.youtube.com/playlist?list=PLSiFUSQSRYAPDKeptJvl88S92seEHJCmn"
|
||
|
"https://www.youtube.com/playlist?list=PLknodeJt-I5FML0R1FfukZB__Y1lYLXMR"
|
||
|
"https://www.youtube.com/playlist?list=PLCpux10P7KDKPb4eI5b_qSnQaY1ePGKGK"
|
||
|
"https://www.youtube.com/playlist?list=PLFdMuo0ICT2D_9Ip8sNduGWQQ8Ib9ngpQ"
|
||
|
"https://www.youtube.com/playlist?list=PLFdMuo0ICT2C3gOqkDL83bpBhJtsF9e5r"
|
||
|
"https://www.youtube.com/playlist?list=PLA66mD-6yK8wXG7ts9RJY5isNabRi8uCT"
|
||
|
"https://www.youtube.com/playlist?list=PLA66mD-6yK8zRjZH-2EgZQGefba_LTeRX"
|
||
|
"https://www.youtube.com/playlist?list=PLRM-PeIcYAz8h_swh98He_7HabXzXVi8K"
|
||
|
"https://www.youtube.com/playlist?list=PLJOFJ3Ok_idsFYz-0bEkWTyXXcqXF6dpw"
|
||
|
"https://www.youtube.com/playlist?list=PLJOFJ3Ok_idtiMTz8fAiF1ElcKJM7Rncj"
|
||
|
"https://www.youtube.com/playlist?list=PLJOFJ3Ok_idt2YLm0mrQ3lc-07pyj4Etv"
|
||
|
"https://www.youtube.com/playlist?list=PLJOFJ3Ok_idsHSibHAy0naQFW2gmCS5XK"))
|
||
|
|
||
|
;; Main function
|
||
|
(define (main args)
|
||
|
(setup-environment)
|
||
|
|
||
|
;; Download each playlist
|
||
|
(for-each
|
||
|
(lambda (playlist)
|
||
|
(format #t "Downloading playlist: ~a~%" playlist)
|
||
|
(download-playlist playlist)
|
||
|
(format #t "Finished downloading playlist: ~a~%" playlist)
|
||
|
(format #t "----------------------------------------~%"))
|
||
|
playlists)
|
||
|
|
||
|
(format #t "All playlists have been processed.~%"))
|