#lang racket ; naver-top-search-scraper (C) 2015 KIM Taegyoon ; Displays naver top searches periodically (require net/url) (require racket/date) (define (read-url url) (port->string (get-pure-port (string->url url)))) (let loop () (define text (read-url "http://www.naver.com")) (define top-line-num #f) (displayln (date->string (current-date) #t)) (for ([line (in-lines (open-input-string text))] [i (in-naturals 1)]) (cond [(regexp-match "" line) (set! top-line-num i)] [(and top-line-num (<= (+ top-line-num 2) i (+ top-line-num 11))) (cond [(regexp-match #px"" line) => (lambda (m) (displayln (list-ref m 1)))])])) (newline) (sleep (* 60 5)) (loop))