X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=extra%2Fyoutube%2Fyoutube.factor;fp=extra%2Fyoutube%2Fyoutube.factor;h=261165dbb454dd5e056b2e370943d7b8b6b58ab1;hp=6d1d549c7f317876584df8a4f8aecd2b5d77f3b4;hb=722d92fbfdeff55645f4148d3016798afe4fd433;hpb=42676f8c59c0a97c89a7a3579ec0c50302b5e8ca diff --git a/extra/youtube/youtube.factor b/extra/youtube/youtube.factor index 6d1d549c7f..261165dbb4 100644 --- a/extra/youtube/youtube.factor +++ b/extra/youtube/youtube.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2013 John Benediktsson ! See https://factorcode.org/license.txt for BSD license -USING: assocs http.client kernel make math.order sequences -splitting urls urls.encoding ; +USING: assocs http.client http.download kernel math.order +sequences splitting urls urls.encoding ; IN: youtube @@ -66,12 +66,12 @@ CONSTANT: video-info-url URL" https://www.youtube.com/get_video_info" : downloadable? ( video-info -- ? ) "use_cipher_signature" of "False" = ; -: download-video ( video-id -- ) +: download-video ( video-id -- path ) get-video-info [ downloadable? [ "Video is encrypted." throw ] unless ] [ video-formats [ "type" of "video/mp4" head? ] find nip video-download-url ] [ - "title" of sanitize ".mp4" append download-to + "title" of sanitize ".mp4" append download-once-to ] tri ;