Andy Melnikov (nponeccop) wrote,
Andy Melnikov

Мой вариант

И меня вылечат! Правда, тут нет самой неинтересной части - функция table :: String -> [String] парсит только названия участков.
module Main where

import Network.HTTP
import Text.Regex.Posix
import Control.Monad

match p s = map (head . tail) (s =~ p :: [[String]])

rootUrl = ""
      ++ "action=show&root=1&tvd=2772000268687&vrn=2772000268682&region=77"
      ++ "&global=&sub_region=77&prver=0&pronetvd=0&vibid=2772000268687&type=379"

urls = match "\"(h.*379)\"" 
table = match "<nobr>([^<0-9]+[0-9]+)</nobr>"

process parser mapper url = simpleHTTP (getRequest url)
	>>= getResponseBody 
	>>= mapM mapper . parser 

main = (process urls $ process urls $ process table putStrLn) rootUrl

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.