Created
December 20, 2017 10:46
-
-
Save Skrylar/9c735f4a6e50c5778e02054ac1a8cfe0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 libcurl | |
const | |
feed = "https://feeds.feedburner.com/breitbart?format=xml" | |
var downloaded = newstringofcap(1024) | |
proc onwrite(buffer: cstring; size, nitems: int; outstream: pointer): int = | |
let total = size * nitems | |
for i in 0..<total: | |
downloaded.add buffer[i] | |
return total | |
var handle = easy_init() | |
discard easy_setopt(handle, Opt_url, feed) | |
discard easy_setopt(handle, Opt_verbose, 1) | |
discard easy_setopt(handle, Opt_writefunction, onwrite) | |
echo easy_perform(handle) | |
easy_reset(handle) | |
echo downloaded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment