+Version 1.1 - 2006-01-09
+
+- Add comment downloading.
+
Version 1.0.3 - 2005-12-25
- Get updated journal entries in addition to new entries
Version 1.0.3 - 2005-12-25
- Get updated journal entries in addition to new entries
<?xml version="1.0"?>
<ljdump>
<?xml version="1.0"?>
<ljdump>
- <server>http://livejournal.com/interface/xmlrpc</server>
+ <server>http://livejournal.com</server>
<username>myaccount</username>
<password>mypassword</password>
</ljdump>
<username>myaccount</username>
<password>mypassword</password>
</ljdump>
#
# Copyright (c) 2005-2006 Greg Hewgill
#
# Copyright (c) 2005-2006 Greg Hewgill
-import codecs, md5, os, pickle, pprint, sys, urllib2, xml.dom.minidom, xmlrpclib
+import codecs, md5, os, pickle, pprint, re, sys, urllib2, xml.dom.minidom, xmlrpclib
from xml.sax import saxutils
def calcchallenge(challenge, password):
from xml.sax import saxutils
def calcchallenge(challenge, password):
return r
def getljsession(username, password):
return r
def getljsession(username, password):
- r = urllib2.urlopen("http://livejournal.com/interface/flat", "mode=getchallenge")
+ r = urllib2.urlopen(Server+"/interface/flat", "mode=getchallenge")
response = flatresponse(r)
r.close()
response = flatresponse(r)
r.close()
- r = urllib2.urlopen("http://livejournal.com/interface/flat", "mode=sessiongenerate&user=%s&auth_method=challenge&auth_challenge=%s&auth_response=%s" % (username, response['challenge'], calcchallenge(response['challenge'], password)))
+ r = urllib2.urlopen(Server+"/interface/flat", "mode=sessiongenerate&user=%s&auth_method=challenge&auth_challenge=%s&auth_response=%s" % (username, response['challenge'], calcchallenge(response['challenge'], password)))
response = flatresponse(r)
r.close()
return response['ljsession']
response = flatresponse(r)
r.close()
return response['ljsession']
Username = config.documentElement.getElementsByTagName("username")[0].childNodes[0].data
Password = config.documentElement.getElementsByTagName("password")[0].childNodes[0].data
Username = config.documentElement.getElementsByTagName("username")[0].childNodes[0].data
Password = config.documentElement.getElementsByTagName("password")[0].childNodes[0].data
+m = re.search("(.*)/interface/xmlrpc", Server)
+if m:
+ Server = m.group(1)
+
print "Fetching journal entries for: %s" % Username
try:
os.mkdir(Username)
print "Fetching journal entries for: %s" % Username
try:
os.mkdir(Username)
ljsession = getljsession(Username, Password)
ljsession = getljsession(Username, Password)
-server = xmlrpclib.ServerProxy(Server)
+server = xmlrpclib.ServerProxy(Server+"/interface/xmlrpc")
newentries = 0
newcomments = 0
newentries = 0
newcomments = 0
maxid = lastmaxid
while True:
maxid = lastmaxid
while True:
- r = urllib2.urlopen(urllib2.Request("http://livejournal.com/export_comments.bml?get=comment_meta&startid=%d" % (maxid+1), headers = {'Cookie': "ljsession="+ljsession}))
+ r = urllib2.urlopen(urllib2.Request(Server+"/export_comments.bml?get=comment_meta&startid=%d" % (maxid+1), headers = {'Cookie': "ljsession="+ljsession}))
meta = xml.dom.minidom.parse(r)
r.close()
for c in meta.getElementsByTagName("comment"):
meta = xml.dom.minidom.parse(r)
r.close()
for c in meta.getElementsByTagName("comment"):
newmaxid = maxid
maxid = lastmaxid
while True:
newmaxid = maxid
maxid = lastmaxid
while True:
- r = urllib2.urlopen(urllib2.Request("http://livejournal.com/export_comments.bml?get=comment_body&startid=%d" % (maxid+1), headers = {'Cookie': "ljsession="+ljsession}))
+ r = urllib2.urlopen(urllib2.Request(Server+"/export_comments.bml?get=comment_body&startid=%d" % (maxid+1), headers = {'Cookie': "ljsession="+ljsession}))
meta = xml.dom.minidom.parse(r)
r.close()
for c in meta.getElementsByTagName("comment"):
meta = xml.dom.minidom.parse(r)
r.close()
for c in meta.getElementsByTagName("comment"):