afuna_archive (
afuna_archive) wrote2009-01-02 04:57 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Getting more consistent "light" results
One thing that has frustrated me about interacting with LiveJournal programmatically, is that
Mostly I've kludged around it by working off of the archive pages, which respond to
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:
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.
?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]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
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.
no subject
no subject
no subject
You can't; it's been closed for a few weeks now. Let me know if you can't see the ICs.
no subject
no subject
no subject
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.
no subject
no subject
So, why'd you leave Support? Too much code to be done, not enough time? ;)
no subject
As for leaving Support, I had a few reasons, and yeah, that was one of them :)
no subject
no subject
My dirty secret: I'm not going over my old scripts either XD
Love ya, and miss ya, babe <3