Difference between revisions of "Blog Feed"

From Second Life Wiki
Jump to navigation Jump to search
(New page: == A fun script to grab the latest blog entry.== <lsl>default { { state_entry() { llHTTPRequest("http://blog.secondlife.com/feed",[],""); } http_response(key id,in...)
 
Line 1: Line 1:
Drag this into a prim, and it will get the latest entry off the [http://blog.secondlife.com/feed Blog Feed].
Feel free to abuse it.
--[[User:Kageshen Kirax|Kageshen Kirax]] 00:17, 21 July 2008 (PDT)
== A fun script to grab the latest blog entry.==
== A fun script to grab the latest blog entry.==
<lsl>default
<lsl>default

Revision as of 00:17, 21 July 2008

Drag this into a prim, and it will get the latest entry off the Blog Feed. Feel free to abuse it. --Kageshen Kirax 00:17, 21 July 2008 (PDT)

A fun script to grab the latest blog entry.

<lsl>default { {

   state_entry()
   {
       llHTTPRequest("http://blog.secondlife.com/feed",[],"");
   }
   http_response(key id,integer status,list metadat,string body)
   {
       list a = llParseString2List(body,["description>"],[]);
       list b = llParseString2List(llList2String(a,1),["</"],[]);
       string Desc = llList2String(b,0);
       list c = llParseString2List(body,["<title>"],[]);
       list d = llParseString2List(llList2String(c,1),["</"],[]);
       string Start = llList2String(d,0);
       d = [];
       list e = llParseString2List(body,["<pubDate>"],[]);
       list f = llParseString2List(llList2String(e,1),["+0000"],[]);
       string Date = llList2String(f,0);
       f= [];
       list g = llParseString2List(llList2String(c,2),["</"],[]);
       string Title = llList2String(g,0);
       list get = llParseString2List(llList2String(g,0),["#38;"],[]);
       g = [];
       list h = llParseString2List(body,["<description><![CDATA["],[]);
       f = llParseString2List(llList2String(h,1),["]]></description>"],[]);
       string Info = llList2String(f,0);
       list j = llParseString2List(Info,["#38;"],[]);
       if(llGetListLength(j) > 0)
       {
           Info = "";
           integer i;
           for(i = 0;i < llGetListLength(j);i++)
           {
               Info += llList2String(j,i);
           }
       }
       if(llGetListLength(get) > 0)
       {
           Title = "";
           integer i;
           for(i = 0;i < llGetListLength(get);i++)
           {
               Title += llList2String(get,i);
           }
       }
       j = llParseString2List(Info,["."],[]);
       if(llGetListLength(j) > 0 & llStringLength(Info) > 700)
       {
           llSay(0,"Second Life Blog"+"\n"+Title+"\n"+Desc+"\n"+Start+"\n"+Date);
           integer i;
           for(i = 0;i < llGetListLength(j);i++)
           {
               llSay(0,llList2String(j,i));
           }
       }
       else
       {
           llSay(0,"Second Life Blog"+"\n"+Title+"\n"+Desc+"\n"+Start+"\n"+Date+"\n"+Info);
       }
   }

}</lsl> Note that it doesn't work perfectly, sometimes there may be a few bugs with the llHTTPRequest, but otherwise have fun!