     xkcd-url comic. ;
 
 : random-xkcd. ( -- )
-    "http://dynamic.xkcd.com/random/comic/" comic. ;
+    "https://c.xkcd.com/random/comic/" comic. ;
 
 : latest-xkcd. ( -- )
-    "http://xkcd.com" comic. ;
+    "https://xkcd.com" comic. ;
 
 TUPLE: xkcd number image ;
 

: comic-image ( url -- image )
    http-get nip
    R/ \/\/imgs\.xkcd\.com\/comics\/[^\.]+\.(png|jpg)/
    first-match >string "http:" prepend load-http-image ;

: comic-image. ( url -- )
    comic-image image. ;

PRIVATE>

: xkcd-url ( n -- url )
    "https://xkcd.com/%s/" sprintf ;

: xkcd-image ( n -- image )
    xkcd-url comic-image ;
