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