Secret Crushes
Feb. 6th, 2004 07:32 pmThe LJ Secret Crush meme is fairly vile, since they collected a bunch of information and are now selling it and maybe you didn't want to let that person know you had a crush on them? Too late now.
rowyn passed on a great idea from
peganthyrus. She suggested that we pick random users and fill out crush info for them, poisoning the database. That's not bad.
This works on my system. Maybe it'll work on yours. At the moment it spews the HTML for the return page to standard output, because I couldn't be bothered to parse through it and summarize results. There is no error-checking. The code is low-quality. You will need the CPAN modules HTML::TokeParser and WWW::Mechanize.
This works on my system. Maybe it'll work on yours. At the moment it spews the HTML for the return page to standard output, because I couldn't be bothered to parse through it and summarize results. There is no error-checking. The code is low-quality. You will need the CPAN modules HTML::TokeParser and WWW::Mechanize.
#!/usr/bin/perl
use HTML::TokeParser;
use LWP::UserAgent;
use WWW::Mechanize;
$ua = LWP::UserAgent->new;
$ua->agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)");
$ua->requests_redirectable([ ]);
$random = HTTP::Request->new(HEAD => 'http://www.livejournal.com/random.bml');
my $res = $ua->request($random);
($user = $res->headers->header('Location')) =~ s#^.*/(.*)/#$1#;
if (! $user) {
die "Couldn't get random LJ user.\n";
}
print STDERR "Crushing ", $user, "\n";
my $agent = WWW::Mechanize->new();
$agent->get("http://euthanize.us/memes/secret-crush-meme/");
$agent->form(1);
$agent->field("username", $user);
$agent->click;
@types = ("Never Crushed", "Secret Crush", "Public Crush", "Ex-Crush");
$agent->form(1);
$crushform = $agent->current_form;
@friends = split(/,/, $crushform->value("friends"));
for ($i = 0; $i <= $#friends; $i++) {
$crushtype = $types[int(rand(4))];
$friendfield = "friend" . $i;
$agent->field($friendfield, $crushtype);
}
$gender = (rand(2) > 1 ? "Male" : "Female");
$agent->field("gender", $gender);
$agent->click;
print $agent->content;
Re: Fixing the output
Date: 2004-02-09 07:25 pm (UTC)I was gonna rewrite the whole thing to divest myself of excess modules completely -- wouldn't have been hard -- but events progressed without me.
Re: Fixing the output
Date: 2004-02-12 09:21 am (UTC)This is probably a bug that should be reported - livejournal does some checking so that early close tags in entries can't completely mess up a friends view (to completely mess up a friends view, I think you'd need a close-div, close-table, close-div combination, and they seem to strip close tags after an extraneous close-div) An extraneous close-div or close-tr in an entry still produces interesting effects, but they don't bleed onto the rest of the page.
It would seem that they could do similar checking in the comments to prevent the extraneous close-tr from wreaking havoc.