[racket] read WebPage

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed Jun 12 15:25:34 EDT 2013

Try the html-parsing library from PLaneT.

#lang racket
(require net/url (planet neil/html-parsing:2:0)
         (planet jim/sxml-match:1:1/sxml-match))

(html->xexp
 (get-pure-port
  (string->url "http://www.tijd.be/beurzen/Societe_Generale.360017048")))

Then take a look at sxml-match when you need to work with the result.

-- 
Jens Axel Søgaard



2013/6/12 Frank Weytjens <fweytjens.android at gmail.com>:
>
> Hi Racket users,
>
> I'm trying to extract some information from a webpage.
> First attempt is to read the complete page
> Later i will try to filter the StockPrice and Volume at a certain time
> The goal is to calculate what direction the StocPrice is moving in
> multiplied by the number of Stocks that changed owner during vast amounts of
> time.
> Like if it was a moving/accelerating mass in fysics and you want to know
> it's momentum
> The value of this program is void.
> It's just for fun.
>
> The first problem I encounter is that reading the webpage stops at the first
> curly bracket
>
> #lang racket
> (require net/url)
> (define GLE (get-pure-port (string->url
> "http://www.tijd.be/beurzen/Societe_Generale.360017048")))
> (define readPage
>   (lambda (ticker)
>     (read/recursive ticker)))
> (define readMore
>     (lambda ()
>       (let ([length  (pipe-content-length GLE)])
>         (if (< (file-position* GLE) length) ((display (readPage GLE))
> (readMore)) (print 'Finished)))))
>
> (readMore)
>
>
> error --> .....ascript>djConfig=. read: unexpected `}'
>
>
> Sorry for the naive code, i'm just a beginner.
>
> Thanks in advance
>
> Frank
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>



-- 
--
Jens Axel Søgaard


Posted on the users mailing list.