Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import htmlparser
- import xmltree # To use '$' for XmlNode
- import httpclient
- import streams
- import encodings
- proc getBashQuote(html: string): string =
- let html = parseHtml(newStringStream(html))
- for elem in html.findAll("div"):
- if elem.attr("class") == "text":
- let text = elem.innerText
- return text
- let client = newHttpClient()
- let data = client.get("http://bash.im/quote/444074")
- echo getBashQuote(data.body).convert("UTF-8", "CP1251")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement