Log in

No account? Create an account
LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Grabbers, grabbers, grabbers [Jul. 3rd, 2005|05:34 pm]
LiveJournal Client Discussions
[mood |confusedconfused]

Hey client gang, I've got a question for your expert review:

I'm trying to make a 'teaser' script for my own personal website. Basically, I'm trying to "grab" elements from my latest LJ entry and put them into an HTML page through some kind of scripting. The end product would be something like:

On [date], I blogged [subject]:
Descrip: [teaser - first 60 characters]... (more)

So basically, I would be able to have my homepage automagically display my most recent blog entry / date, and a 60 or so character 'teaser' of that entry. My problem is that I don't know how to grab the date / entry / subject data into an HTML format from LJ's database. I can worry about truncating the entry data later (i.e., limiting it to the first 60 characters). I don't have a paid account, but that shouldn't matter. Does anyone know how to get an HTML page to play nice with LJ data?

- vtmemo

[User Picture]From: drdaeman
2005-07-05 06:29 pm (UTC)
You can use your RSS feed to get all the required data... Fetch the RSS feed (don't forget about caching it locally), parse it (this can be done with some XML parser or just some simple regexp matching) and use. :) The detailed implementation depends on the scripting language you're using on your server...
(Reply) (Thread)
From: vtmemo
2005-07-05 07:33 pm (UTC)

non-rss methods?

Is there a way to do it client-side? Like, a javascript grabber?

Not sure if this is possible or not, though I've seen similar things in action.
(Reply) (Parent) (Thread)
[User Picture]From: drdaeman
2005-07-05 07:52 pm (UTC)

Re: non-rss methods?

Hmm... No ideas, because in the ideal world a script from page at somedomain.com mustn't be able to access any data from otherdomain.com, only from *.somedomain.com... =/ So.. Sorry, but I think this isn't possible for client-side script only with free account... =(
(Reply) (Parent) (Thread)
From: vtmemo
2005-07-05 08:27 pm (UTC)

Re: non-rss methods?

Yeah - I've seen it done once or twice (not sure if Hutta in his Raw Journal LJ-toy used a similar method to grab data, but I know it works for non-paid accounts as well.

Maybe his script is running server-side and just caches the data locally. I can't be sure; tried to reach him via IM but no luck.
(Reply) (Parent) (Thread)
[User Picture]From: drdaeman
2005-07-05 08:34 pm (UTC)

Re: non-rss methods?

As far as I understand his script is running server-side (there's no any client side code there, you can try disabling scripts in your browser and that toy will work anyway) and also caches data remotely (there's no local code... how can it cache something locally?)
(Reply) (Parent) (Thread)
[User Picture]From: njyoder
2005-07-05 09:15 pm (UTC)

Re: non-rss methods?

You can use AJAX to fetch it with javascript. The majors browsers each provide a javascript method to fetch remote XML documents and process them. You can just google for tutuorials and references.
(Reply) (Parent) (Thread)
[User Picture]From: decadence1
2005-07-06 10:16 pm (UTC)
Coincidentally, the LJ Support sphere embedding gurus overhauled the user documentation on this within the last few days.

The newer version (end-user FAQs now link to the newer content provided in a 'HowTo' journal - it offers easier updating over patchable .bml pages) includes addition of guidance on ASP.NET and JSP methods. Embedding - Method Index

Commenting more for the future viewers of this entry than parent commenter. :)
(Reply) (Parent) (Thread)