[drakma-devel] Re: drakma-devel Digest, Vol 20, Issue 1
Nico Garcia Belmonte
philogb at gmail.com
Thu Jun 5 17:28:43 UTC 2008
It works!
Thanks a lot!
On 6/5/08, drakma-devel-request at common-lisp.net <
drakma-devel-request at common-lisp.net> wrote:
>
> Send drakma-devel mailing list submissions to
> drakma-devel at common-lisp.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
> or, via email, send a message with subject or body 'help' to
> drakma-devel-request at common-lisp.net
>
> You can reach the person managing the list at
> drakma-devel-owner at common-lisp.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of drakma-devel digest..."
>
>
> Today's Topics:
>
> 1. Handling chunked content (Nico Garcia Belmonte)
> 2. Re: Handling chunked content (Edi Weitz)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 5 Jun 2008 02:43:48 +0200
> From: "Nico Garcia Belmonte" <philogb at gmail.com>
> Subject: [drakma-devel] Handling chunked content
> To: drakma-devel at common-lisp.net
> Message-ID:
> <4e2f5dc00806041743p7b2e6d29kc36dd8e84d4630ff at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> ...I'm kind of a newbie, so please forgive me if I make stupid questions.
> I've been using drakma to request html pages and everything seems to work
> fine.
>
> I'm now using drakma to make a request to the new youtube json api, and I
> get chunked content:
>
> (http-request "
>
> http://gdata.youtube.com/feeds/api/videos/-/Music/?max-results=10&vq=bush&alt=json&format=5
> ")
>
> ...chunked content...
>
> ((:CONTENT-TYPE . "application/json; charset=UTF-8")
> (:CACHE-CONTROL . "max-age=0, must-revalidate, no-transform, private")
> (:GDATA-VERSION . "1.0") (:LAST-MODIFIED . "Thu, 05 Jun 2008 00:20:27
> GMT")
> (:TRANSFER-ENCODING . "chunked") (:DATE . "Thu, 05 Jun 2008 00:20:27
> GMT")
> (:SERVER . "GFE/1.3") (:CONNECTION . "Close"))
> #<PURI:URI
>
> http://gdata.youtube.com/feeds/api/videos/-/Music/?max-results=10&vq=bush&alt=json&format=5
> >
> #<FLEXI-STREAMS:FLEXI-IO-STREAM {B90E249}>
>
> The thing is that I need it to be a string in order to decode to json
> format
> using the cl-json lisp package.
> I tried changing the external-output parameter without any good results.
>
> Do you have some advice on how I could serialize this content?
>
> Thanks at advanced!
>
> Your library is great!
>
> Nico.
>
> --
> I would never die for my beliefs because I might be wrong.
>
> Bertrand Russell
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://common-lisp.net/pipermail/drakma-devel/attachments/20080605/47a1bee6/attachment.htm
>
> ------------------------------
>
> Message: 2
> Date: Wed, 04 Jun 2008 21:26:45 -0400
> From: Edi Weitz <edi at agharta.de>
> Subject: Re: [drakma-devel] Handling chunked content
> To: General interest list for Drakma and Chunga
> <drakma-devel at common-lisp.net>
> Message-ID: <u63sowu22.fsf at agharta.de>
> Content-Type: text/plain; charset=us-ascii
>
> On Thu, 5 Jun 2008 02:43:48 +0200, "Nico Garcia Belmonte" <
> philogb at gmail.com> wrote:
>
> > ...I'm kind of a newbie, so please forgive me if I make stupid
> > questions. I've been using drakma to request html pages and
> > everything seems to work fine.
> >
> > I'm now using drakma to make a request to the new youtube json api,
> > and I get chunked content:
> >
> > (http-request "
> >
> http://gdata.youtube.com/feeds/api/videos/-/Music/?max-results=10&vq=bush&alt=json&format=5
> > ")
> >
> > ...chunked content...
> >
> > ((:CONTENT-TYPE . "application/json; charset=UTF-8")
> > (:CACHE-CONTROL . "max-age=0, must-revalidate, no-transform, private")
> > (:GDATA-VERSION . "1.0") (:LAST-MODIFIED . "Thu, 05 Jun 2008 00:20:27
> GMT")
> > (:TRANSFER-ENCODING . "chunked") (:DATE . "Thu, 05 Jun 2008 00:20:27
> GMT")
> > (:SERVER . "GFE/1.3") (:CONNECTION . "Close"))
> > #<PURI:URI
> >
> http://gdata.youtube.com/feeds/api/videos/-/Music/?max-results=10&vq=bush&alt=json&format=5
> >>
> > #<FLEXI-STREAMS:FLEXI-IO-STREAM {B90E249}>
> >
> > The thing is that I need it to be a string in order to decode to
> > json format using the cl-json lisp package. I tried changing the
> > external-output parameter without any good results.
> >
> > Do you have some advice on how I could serialize this content?
>
> Your problem is not chunked content (Drakma takes care of that
> automatically) but that the server returns a content type which is by
> default not recognized as text. See for example here:
>
> http://weitz.de/drakma/#*text-content-types*
> http://weitz.de/drakma/#*body-format-function*
>
> In your particular case, something like this will probably do the
> trick:
>
> (let ((*text-content-types* (cons '("application" . "json")
> *text-content-types*)))
> (http-request "
> http://gdata.youtube.com/feeds/api/videos/-/Music/?max-results=10&vq=bush&alt=json&format=5
> "))
>
> Cheers,
> Edi.
>
>
> ------------------------------
>
> _______________________________________________
> drakma-devel mailing list
> drakma-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
>
>
> End of drakma-devel Digest, Vol 20, Issue 1
> *******************************************
>
--
I would never die for my beliefs because I might be wrong.
Bertrand Russell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/drakma-devel/attachments/20080605/5a6e0ffd/attachment.html>
More information about the Drakma-devel
mailing list