|Getting friends events
||[Oct. 23rd, 2002|04:19 pm]
LiveJournal Client Discussions
|||||John Digweed - Jan Driver - Filter||]|
I am trying to build a custom friends page in PHP and cannot see a way to get events for friends. I can login and get a list of friends and check to see if there are any new events for all of my friends, but I would like to build a list of only friends that have new entries. How can I check to see which friends have new events and then download the event itself for that friend?
As far as the protocol goes:
- The checkfriends mode only tells you that there have been updates, but nothing more. This is a performance consideration. You can limit the friends checking to friends in certain friend groups you have defined, but that really doesn't solve your problem.
- The getevents mode only allows you to get events from journals the logged in user has access to. That is, your own journal and any communities you have joined. [In my opinion, getevents should not require a username/password and should work for any journal. But you didn't ask for my opinion.]
Are you trying to create something that you could not ordinarily do with a friends view style?
Yes. Those two protocol modes, and their limitations, are what I have found. I agree with you on the GetEvents mode. I feel I should be able to log in and download and events that I would have permission to view (with that login).
What I want to do is create a more condensed version of the friends page. Here is an example of what I had in mind: http://www.livejournal.com/talkread.bml?journal=elmofromok&itemid=48710
Ideally, you should add a mode that does what you want, and then contribute it to the server source code. Given how unlikely that is...
I was about to suggest that you use a combination of checkfriends and HTML scraping, then I remembered LJ has an RSS view. If you don't know what that is, do a search. You should be able to use getfriends to get your list of friends, and then parse their RSS feeds to figure out what is new.
Let me know how that goes.
well when i get to the point that I am capable as a programmer to add the mode I will. Not there yet, however I am learning.
I was not aware that LJ had an RSS feed. That may be just what I need. Thanks.
2002-10-23 11:26 pm (UTC)
The other thing to do is to parse your normal friends page (eg file(http://www.livejournal.com/users/elmofromok/friends
) and then run through it systematically to extract data, since you know the format and layout of this page is unlikely to change too often. I did this for a while, after running up against the brick wall that is the LJ "protocol". There are always ways round things, but you have to be careful people don't put odd html into their entries, which you might be looking for as an entry delimiter.
The rss feed method would be great if you could get a feed off your friends page. You have to resort to getting one "protocol" page and multiple feeds, and when I've tried this before, the servers simply don't respond fast enough. You get a cripplingly slow page and stuff times out, even when you're hosted on a server with a 2mb pipe, like I was.
Admittedly, I was using jiggery-pokery to extract people's user icons too, which would take up an extra page fetch per person, but it's still unrealistic.
getevents should return any public entries if you don't supply a username/password - I can't imagine why it doesn't!
Well I was hoping for a more eloquent solution than tearing apart an html page, but I will experiment with it and see what I can do. This will not solve many of the problems I was hoping to solve by creating my own friends page, but its a start. Thanks for the help anyways.