Andy Melnikov (nponeccop) wrote,
Andy Melnikov
nponeccop

Мой вариант

И меня вылечат! Правда, тут нет самой неинтересной части - функция 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 = "http://www.moscow_city.vybory.izbirkom.ru/region/region/moscow_city?"
      ++ "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
Subscribe

  • Post a new comment

    Error

    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.
  • 86 comments