Created
August 29, 2018 11:46
-
-
Save sepisoad/4af65c2e57cc7a4f69cf97ed6ae26ce6 to your computer and use it in GitHub Desktop.
fetch urls from a url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require net/url) | |
(if (< (vector-length (current-command-line-arguments)) 1) | |
(display "please define url\n") | |
(display "please wait ...\n")) | |
(define URL (vector-ref (current-command-line-arguments) 0)) | |
(display (string-append URL "\n")) | |
(let ([html (call/input-url | |
(string->url URL) | |
get-pure-port | |
port->string)]) | |
(let ([matches (regexp-match* #rx"href=\"https?://.*?\"" html)]) | |
(for ([m matches]) | |
(display (substring m 6 (- (string-length m) 1))) | |
(newline)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment