spider function

This commit is contained in:
erana 2012-02-01 16:38:59 +09:00
parent 1d6fe443fb
commit ace1c922dc
1 changed files with 8 additions and 8 deletions

View File

@ -32,15 +32,15 @@
(spider-rec (list hostname) 0)) (spider-rec (list hostname) 0))
(define (spider-rec hostname-list index) (define (spider-rec hostname-list index)
(let ((file-contents (file->string (string-append dir-filename "/" "index.html"))))
(let ((url-list (file-contents->url file-contents 0))) (let ((url-list (file-contents->url file-contents 0)))
(let ((dir-filename (ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline)) "index.html" hostname port))) (let ((dir-filename (ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline)) "index.html" hostname port)))
(let ((file-contents (file->string (string-append dir-filename "/" "index.html"))) (let ((hostname-list (append hostname-list (url->hostname url-list '())))
(hostname-list (append hostname-list (url->hostname url-list '())))
(keyword-list (file-contents->keyword file-contents keyword))) (keyword-list (file-contents->keyword file-contents keyword)))
(hash-set! table (string-append keyword (number->string index)) file-contents);;NOTE keys are variable due to append above (hash-set! table (string-append keyword (number->string index)) file-contents);;NOTE keys are variable due to append above
(spider-rec (cdr hostname-list) (+ index 1)) (spider-rec (cdr hostname-list) (+ index 1))
)))) )))))