Hi. The following Tcl/Tk script is just a frontend interface for the application get_flash_videos.
get_flash_videos downloads online videos from websites like YouTube and save them as a normal file where you can watch the video directly from your computer without the need to use the Internet at all.
The problem with get_flash_videos is that it only downloads a single video and it does not download a complete playlist. This means it does not download each video belonging to this playlist. Therefore I made this interface script.
I made this script to run on Debian GNU/Linux 7.0 . It should work on other Linux systems.
You have to understand that this ONLY downloads YouTube playlists. Nothing else.
To run this script :
The script is below this line.
#!/usr/bin/wish
if { [ catch { exec which get_flash_videos } ] !=0 } {
tk_messageBox -icon error -title "Missing Application" -detail "Please install the package get-flash-videos because it's missing. It's the download tool.\nIn debian systems as user 'root' enter on your terminal:\n\n apt-get install get-flash-videos"
exit
}
package require http
package require tdom
set all_video_ids [list] ;# this is a global variable
proc explore {parent} {
set type [$parent nodeType]
global all_video_ids
set name [$parent nodeName]
set value [$parent asText]
if { $name=="title" } {
puts "named $name has value $value"
.youtube_video_title configure -text "title: $value"
update
}
if { $name=="yt:videoid" } {
puts "named $name has value $value"
#lappend all_video_ids $value
exec get_flash_videos "https://www.youtube.com/watch?v=$value"
.youtube_playlist_url_video_ids_list insert end $value
update
#after 2000 ;#uncomment this pause if you want to test.
}
if {$type != "ELEMENT_NODE"} then return
foreach child [$parent childNodes] {
explore $child
}
}
label .paste_your_playlist -text "Paste your YouTube playlist url here and click the button below"
entry .youtube_playlist_url_entry
label .youtube_playlist_url_video_ids_label -text "Video IDs of the playlist"
listbox .youtube_playlist_url_video_ids_list
label .youtube_video_title -text "Each video title of the playlist is printed here while the playlist is downloaded"
button .get_youtube_playlist_url_video_ids_button -text "get videoids" -command {
set youtube_playlist_url [ .youtube_playlist_url_entry get]
global all_video_ids
set playlist_id [ lindex [ split $youtube_playlist_url "=" ] 1 ]
set http_token [ ::http::geturl "http://gdata.youtube.com/feeds/api/playlists/$playlist_id/?v=2&alt=rss" -method GET ]
set doc [ dom parse [ ::http::data $http_token ] ]
set root [$doc documentElement]
.youtube_playlist_url_video_ids_list delete 0 end
explore $root
}
pack .paste_your_playlist .youtube_playlist_url_entry .youtube_playlist_url_video_ids_label .youtube_playlist_url_video_ids_list .youtube_video_title .get_youtube_playlist_url_video_ids_button