Entry tags:
DW authentication
Hello,
Sorry if my question is offtopic in this community, but it doesn't seem like your dev question thread is very active, so I'll take my chances and ask here. I'm trying to programmatically download DW posts from my journal and have troubles accessing friends-only and private posts. Suppose I have the following request:
GET https://ari-linn.dreamwidth.org/545896.html?format=light&expand_all=1 HTTP/1.1
Host: ari-linn.dreamwidth.org
It results in an error page: "You need to be logged in to see this content."
I thought about logging in programmatically to DW and grabbing cookies to pass with the request, but my attempts are getting me nowhere. I can successfully get challenge and compute response from this:
POST http://www.dreamwidth.org/interface/flat HTTP/1.1
Host: www.dreamwidth.org
mode=getchallenge&ver=1
But I can't login using the challenge-response pair. The following request is invariably giving me an error page: "There was an error processing your request: This account name was not found." Why it can't recognize the user=ari_linn parameter is honestly beyond me.
POST https://www.dreamwidth.org/login?ret=1 HTTP/1.1
Host: www.dreamwidth.org
chal=c0:some:very:complicated:challenge:here&response=md5(challenge_plus_md5(password))&user=ari_linn
Is there any way I can programmatically login to DW to access private posts?
Sorry if my question is offtopic in this community, but it doesn't seem like your dev question thread is very active, so I'll take my chances and ask here. I'm trying to programmatically download DW posts from my journal and have troubles accessing friends-only and private posts. Suppose I have the following request:
GET https://ari-linn.dreamwidth.org/545896.html?format=light&expand_all=1 HTTP/1.1
Host: ari-linn.dreamwidth.org
It results in an error page: "You need to be logged in to see this content."
I thought about logging in programmatically to DW and grabbing cookies to pass with the request, but my attempts are getting me nowhere. I can successfully get challenge and compute response from this:
POST http://www.dreamwidth.org/interface/flat HTTP/1.1
Host: www.dreamwidth.org
mode=getchallenge&ver=1
But I can't login using the challenge-response pair. The following request is invariably giving me an error page: "There was an error processing your request: This account name was not found." Why it can't recognize the user=ari_linn parameter is honestly beyond me.
POST https://www.dreamwidth.org/login?ret=1 HTTP/1.1
Host: www.dreamwidth.org
chal=c0:some:very:complicated:challenge:here&response=md5(challenge_plus_md5(password))&user=ari_linn
Is there any way I can programmatically login to DW to access private posts?

no subject
The /login page is designed for browsers, not programmatic access. You shouldn't be accessing it from code. You should use the XML-RPC method sessiongenerate to create an ljsession cookie which you then pass in through your requests to the comment export page (which is designed for bots to access).
But yeah, I'd definitely recommend taking an existing client and making it work. This protocol is over a decade old and doesn't conform to any modern expectations of what a protocol should be. In other words it's still pretty janky and the easiest path to success is probably just copying someone else's code.
Code link: https://github.com/dreamwidth/dw-free/blob/develop/src/jbackup/jbackup.pl
no subject
Update: and in http://www.livejournal.com/export_comments.bml?get=comment_body&startid=0 jitemids are actual meaningful values...
no subject
I'd suggest that we clear out the imported content. This means I would take an admin action to purge the imported content (only imported content!) and then you re-initiate the import. This will get fresh copies of the data which should work. (These days the importer is pretty solid.)
What do you think?
no subject
SELECT * FROM comments jitemid_zeros
LEFT JOIN comments jitemid_normal ON jitemid_zeros.posterid = jitemid_normal.posterid AND jitemid_zeros.createddate = jitemid_normal.createddate
WHERE jitemid_zeros.user = 'ari_linn' AND jitemid_zeros.jitemid = 0 AND jitemid_normal.user = 'ari_linn' AND jitemid_normal.comment_id IS NULL
I'm not familiar with your actual db structure but imagine it to be something like this. If these jitemid_zeros are really just duplicates of successfully imported comments that are properly linked to posts, then you'll get empty query result because all the duplicates will be matched.
no subject
Also, we've now got pretty effective ability to detect and delete imported duplicates. If you want me to do so, I can. (Too be clear, this is just the lower numbered ones without comments.)
no subject
As for duplicate posts, I've killed them all myself. Thank you for addressing the issue though, hope it'll help you with the importer, and people won't get duplicates anymore (or at least support will have a tool to identify and remove them promptly).