afuna_archive: (Default)
[personal profile] afuna_archive
One thing that has frustrated me about interacting with LiveJournal programmatically, is that ?format=light does not work on all pages. It's not really something that affects most users would notice, but certain (Greasemonkey) scripts would be much much easier to write if the entry/journal pages could be guaranteed to follow the same format.

Mostly I've kludged around it by working off of the archive pages, which respond to ?format=light, so I could get data consistently. I have a script which scrapes the lj-cut text, so it can be seen in the inbox which does this. [livejournal.com profile] murklins has done me one better, with a script which lj-cuts your inbox, like the entry text. I do not know how I ever lived without this. Lifesaver. Adore, love. Seriously.

But for other pages, it's been a process of trial and error, trying to figure out whether ?format=light is supported (tag page supports it, showing a page based on s1shortcomings). Uh. Archive pages, as mentioned above. Reply pages and entry pages, obviously, using core, I think.

Not affected by ?format=light are friends and recent entries. LJ site scheme pages, meanwhile depend on the user's site scheme, unless you append ?usescheme=blah, which I always forget to /o\

It's all possible, but it can get messy depending on what you're trying to do. Which is why I love that LJ offers a mobile view. Love <3

The gist of it is that LiveJournal offers a minimalistic view for mobile phones/browsers (I suspect screenreaders could benefit). No header graphics, less junk overall, more consistent look/feel, and most importantly if you're hijacking it for scripting, it works consistently! To trigger, you need to supply the appropriate user agent:

GM_xmlhttpRequest({
   method: "GET",
   headers: {"User-Agent":"w"},
   url: $url_here,
   onload: function(details) {
       // do something with details.responseText
   });



The important part is the useragent line. The rest is just the normal stuff you need to fetch and process a page.

I haven't used it in an actual script. And since I don't play around with LJ much anymore, I'm not sure when I will. But it is a potential solution to what has up to now been a tedious problem.

Date: 2009-01-02 03:16 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I... am not sure. I haven't bothered to check. But I also don't know how I could help :)

Date: 2009-01-02 03:22 pm (UTC)
From: [identity profile] av8rmike.livejournal.com
http://www.livejournal.com/support/see_request.bml?id=937187

You can't; it's been closed for a few weeks now. Let me know if you can't see the ICs.

Date: 2009-01-02 03:24 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I can see them... thanks.

Date: 2009-01-02 03:36 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Also, ooh I guess I was wrong about it not affecting "normal" users.

Date: 2009-01-02 03:54 pm (UTC)
From: [identity profile] av8rmike.livejournal.com
Depends how you define "normal"? ;)
I had to do a lot of "code-diving" to try to ascertain how "format=light" was implemented, but the best answer seems to be "haphazardly". I don't know how the developers keep it all straight.

Date: 2009-01-02 04:35 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Point :-) And I'm not sure they do! I get the feeling that S2, integration etc, is sort of bolted together or grew organically.

Date: 2009-01-02 04:39 pm (UTC)
From: [identity profile] av8rmike.livejournal.com
If that's the case, it must be a nightmare to maintain the code base, which is why 6A chose to divest themselves of it.

So, why'd you leave Support? Too much code to be done, not enough time? ;)

Date: 2009-01-02 04:41 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I have great respect for LJ developers for keeping their sanity.

As for leaving Support, I had a few reasons, and yeah, that was one of them :)

Profile

afuna_archive: (Default)
afuna_archive

June 2009

S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 1213
14151617181920
21222324252627
282930    

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 9th, 2025 03:35 pm
Powered by Dreamwidth Studios