Posted to tcl by superlinux-hp at Mon Feb 23 08:36:06 GMT 2015view raw
- #!/usr/bin/tclsh
- package require http
- package require json
- set youtube_playlist_url {https://www.youtube.com/playlist?list=PLsAEIIjTPIo_Ja5sHIb6H-Fpnh2-LAwmv}
- 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=json&feature=plcp" -method GET ]
- set youtube_dictionary [ ::json::json2dict [ ::http::data $http_token ] ]
- puts output:
- set video_entries [ dict get [ dict get $youtube_dictionary feed] entry]
- puts [ lsearch -inline -regexp {http://www\.youtube\.com/v/.*version} $video_entries]