Closed Metaxal closed 4 years ago
There's no way at the moment but it should be straightforward to add I think.
Are you trying to programmatically retrieve pastes?
Yes, for selected pastes only, no batching. It's so that people can post scripts for DrRacket's Quickscript without having a github (gists) or gitlab account (snippets).
I think I have something working. Is something like this sufficient? http://pasterack.org/pastes/8953/raw
It's perfect, thanks!
Hmm, actually the raw pastes are still serving html. is that ok? The raw gists seem to be serving a plain txt file?
oh, I assumed it was raw text. I'd rather have plain txt (since gists and snippets serve raw text). If it takes you more than 30min, don't bother, I'm not even sure how useful this would be in general.
It's been a while since I used the webserver and there doesnt seem to be a convenient response/text
. Do you know off the top of your head how to do it with the more general response
forms?
More specifically, I can return the raw text, but it doesnt render properly like the gists, eg: http://pasterack.org/pastes/8953/raw
Is that ok?
Yes, that looks good, apart from the \r\n
in the source, but I can easily strip these off.
Currently, I'm fetching the raw texts with this:
#lang racket
(require net/url)
(displayln
(port->string (get-pure-port (string->url "http://pasterack.org/pastes/8953/raw")
#:redirections 10)))
Thanks!
Ok i figured it out. just had to change the mime-type
to text/plain
.
The line breaks are preserved from what the user submitted I think. But yes, should be easy to remove.
Let me know if there are any other problems.
That's perfect, thank you!
Hi,
Is there a way to access the raw code, like gists (with the '/raw' suffix)?