BENZILLA ATTACKS (vanbeast) wrote in lj_nifty,
BENZILLA ATTACKS
vanbeast
lj_nifty

Friends Groups analyzer

For about 8 months, I've had this little script laying around, but I just now got 'round to fixing it up and making it suitable for public consumption. About 8 months ago, I had a need (long since forgotten) to figure out which posts I had posted using which friends groups. There's no easy way to do this when you have well over a thousand entries, so I decide to let my computer do the work. I'd been using the excellent jbackup.pl to keep a backup of my journal and comments, so it made a lot of sense to use that for my tool.

A side note: both jbackup.pl and my script require an environment that can execute perl code and some added modules. If this doesn't make sense to you or if you don't have access to such a thing, I'm sorry but you can't play :( I've thought about this at length and there's no good way that I can securely make this available to people who can't run it themselves. Perhaps someone can reimplement it for Windows or Mac or in Java or something, but I don't have the skillz for that. I thought about doing a web service but one way or the other you'd have to hand your journal over to me and that's no good. So if you can't run it yourself, you're SOL for now.

For jbackup.pl, you'll need the following modules:
  • GDBM_File
  • XMLRPC::Lite - Part of the SOAP::Lite package
  • XML::Parser
  • Term::ReadKey
My script uses the same modules, so if you can run jbackup.pl, you can run mine :)

I'm not sure what the best way to get jbackup.pl is. I know it's in the LiveJournal CVS. You can get it thusly:
cvs -d :pserver:anonymous@cvs.livejournal.org:/home/cvslj login
cvs -d :pserver:anonymous@cvs.livejournal.org:/home/cvslj co livejournal/src/jbackup/jbackup.pl
enter an empty password after the login step. Or you can download this file.

In order to use it, you must first backup your journal using jbackup.pl:
./jbackup.pl  --sync
Username: exampleusername
Password:
Then a bunch of text will scroll by. Once it's done, run my script:
./ljgroupanalyze.pl -j exampleusername
Enter your password:
After entering your password, output similar to the following will appear:
+------------+
| some group |
+------------+
http://www.livejournal.com/users/exampleusername/14438.html
http://www.livejournal.com/users/exampleusername/15262.html
+---------------+
| another group |
+---------------+
http://www.livejournal.com/users/exampleusername/14847.html
http://www.livejournal.com/users/exampleusername/15262.html
+-------------+
| third group |
+-------------+
http://www.livejournal.com/users/exampleusername/14854.html
Note that one post (15262.html) is in both Some Group and Another Group. It supports complex filtering! Amazing!

I'm sure many of you are wondering why it requires your password. The reason is simple: it phones home to the server to fetch the names of your friends groups. That's all. If you look at the code, you'll see that the only place the password is used is in generating the response segment of a challenge/response handshake for authentication while downloading the group names.

It should be noted that jbackup.pl was written by the LiveJournal staff (marksmith, to be specific) and you shouldn't worry that it asks for your password. Besides, it's backing up your journal... how else would it work? :)

If you're uncomfortable giving your password to my script, there's another option... though you should be warned it's a bit less useful. You can invoke the script with --simple, and all you'll get is a list of posts with their associated allowmask:
16 -- http://www.livejournal.com/users/bleything/14847.html
32 -- http://www.livejournal.com/users/bleything/14854.html
24 -- http://www.livejournal.com/users/bleything/15262.html
8 -- http://www.livejournal.com/users/bleything/14438.html
The numbers represent the allowmask of the post... you see, each friends group has a particular bit, and permission to view a post is determined by ANDing that mask with the blah blah blah. See, it's not as useful. But it's there for the paranoid.

There are two ways to get the code. The first (and best!) is to check it out of my subversion repository. If you have svn installed, you can do so by issuing the following command:

svn co http://svn.bleything.net/toys/ljgroupanalyzer

This way you can keep up-to-date as I add new features. Another good way is to just fetch this URL. That'll always be up-to-date as well. If there's demand, I can put together a distribution tarball or .zip or something.

If you identify issues with the code, please feel free to either comment here or (preferred!) open a ticket here. Make sure you select ljgroupanalyzer as the component!

I also welcome all other comments or questions. Thanks for checking it out :)
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 20 comments