Created
April 5, 2020 19:51
-
-
Save falsovsky/a89c621119b804a0e7b07312ca001dea to your computer and use it in GitHub Desktop.
Maria nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httpClient | |
import json | |
import strutils | |
import strformat | |
const random_url = "https://maria.deadbsd.org/api/random" | |
var client = newHttpClient() | |
let jsonTree = parseJson(client.getContent(random_url)) | |
let msg_text = jsonTree["message"]["text"].getStr().strip() | |
let msg_date = jsonTree["message"]["datetime"].getStr() | |
let msg_user = jsonTree["message"]["user"].getInt() | |
let msg_magazine = jsonTree["message"]["magazine"].getStr().toLowerAscii()[0] | |
echo(fmt"{msg_text} - #{msg_user} - {msg_date} [{msg_magazine}]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOU HOMEM 42ANOS CASCAIS GOSTAVA DE EMCOMTRAR SENHORA COM DEFEITOS E VIRTUDES ASSUNTO SERIIO - #29847 - 2017-04-19 20:20:00 [m] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment