Exporting Comments
body<=
LiveJournal Bot Policy page, which discusses more general
rules on how to download information from our servers without getting yourself banned. Also please
follow the directions contained in this guide. p?>
sessiongenerate protocol mode or by posting login information to the
login.bml page. p?>
Element | Attribute | Mode | Mutable | Description |
W3C Date and Time format.' ],
[ 'property', '', 'body', 'no', 'The property tag has one attribute, name, that indicates the name of this property. The content of the tag is the value of that property.' ],
);
my $ret = '';
foreach my $r (@elements) {
$ret .= "\n";
$ret .= "$_ | \n" foreach @$r;
$ret .= "
\n";
}
return $ret;
}
_code?>
NOTE: Please cache metadata, but note that it does contain things that
can change about a comment. You should follow these instructions to update your cache once in a while.
standout?>
GET /export_comments.bml?get=comment_meta&startid=0 p?>
<?xml version="1.0" encoding='utf-8'?>
<livejournal>
<maxid>100</maxid>
<comments>
<comment id='71' posterid='3' state='D' />
<comment id='70' state='D' />
<comment id='99' />
<comment id='100' posterid='3' />
<comment id='92' state='D' />
<comment id='69' posterid='3' state='S' />
<comment id='98' posterid='3' />
<comment id='73' state='D' />
<comment id='86' state='S' />
</comments>
<usermaps>
<usermap id='6' user='test2' />
<usermap id='3' user='test' />
<usermap id='2' user='xb95' />
</usermaps>
</livejournal>
p?>
sub gather_metadata
get largest comment id known about from my cache
GET /export_comments.bml?get=comment_meta&startid=maxid+1
add results to metadata cache
if maximum id returned is less than maxid returned, call gather_metadata again
end sub
p?>
WARNING: Comment body data is to be heavily cached. None of
this data can change. Once you have downloaded a comment, you do not need to do so again.
standout?>
sub download_comments
get largest comment id we have fully downloaded
GET /export_comments.bml?get=comment_body&startid=maxid+1
add results to comment cache
if maximum id returned is less than maxid in metadata cache, call download_comments again
if nothing was returned, and startid+1000 < maxid from metadata, call download_comments again
end sub
p?>
<?xml version="1.0" encoding='utf-8'?>
<livejournal>
<comments>
<comment id='68' posterid='3' state='S' jitemid='34'>
<body>we should all comment all day</body>
<date>2004-03-02T18:14:06Z</date>
</comment>
<comment id='69' posterid='3' state='S' jitemid='34'>
<body>commenting is fun</body>
<date>2004-03-02T18:16:08Z</date>
</comment>
<comment id='99' jitemid='43' parentid='98'>
<body>anonynote!</body>
<date>2004-03-16T19:06:31Z</date>
<property name='poster_ip'>127.0.0.1</property>
</comment>
<comment id='100' posterid='3' jitemid='43' parentid='98'>
<subject>subject!#@?</subject>
<body><b>BOLD!</b></body>
<date>2004-03-16T19:19:16Z</date>
</comment>
</comments>
</livejournal>
p?>
Bot Policy page. p?>
<=body
page?>