(Emotional) PDF-attachment

16 views
Skip to first unread message

Rintze Zelle

unread,
May 16, 2009, 6:10:13 AM5/16/09
to zotero-dev
I'm a bit stuck updating the BioOne translator when it comes to
attaching the PDF. E.g. for the article abstract at "http://
www.bioone.org/doi/abs/10.1653/024.092.0101", a link to the pdf is
provided: "http://www.bioone.org/doi/pdf/10.1653/024.092.0101". This
URL links to a HTML page with an embedded PDF (this PDF seems to have
the same URL as the HTML page). Just downloading this link doesn't
seem to work, e.g. if I try:

translator.setHandler("itemDone", function(obj, item) {
item.attachments = [{url:"http://www.bioone.org/doi/pdf/
10.1653/024.092.0101", title:"BioOne Full Text PDF",
mimeType:"application/pdf"}];
item.complete();
});

I don't get an error in Zotero 1.0.10, but I don't get an attachment
either. If I try to download the PDF via doGet, I do seem to be able
to grasp it, e.g.:

Zotero.Utilities.HTTP.doGet("http://www.bioone.org/doi/pdf/
10.1653/024.092.0101", function(text) {
Zotero.debug(text);
}, function() {Zotero.done();});
Zotero.wait();

shows garbled-PDF binary data in the output of Scaffold. Not sure if
this latter approach can be used to attach the PDF to the item though.

Rintze

Frank Bennett

unread,
May 16, 2009, 6:45:44 AM5/16/09
to zoter...@googlegroups.com
Not sure if it's relevant, but the PDF link wants to set a cookie
before the download begins. Here's the trace I got from wget. It's
in two parts:

Connecting to www.bioone.org|129.41.23.181|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.0 302 Found
Server: AtyponWS/7.1
P3P: CP="NOI DSP ADM OUR IND OTC"
Location: http://www.bioone.org/doi/pdf/10.1653/024.092.0101?cookieSet=1
Set-Cookie: I2KBRCK=1; path=/; expires=Fri, 14-Aug-2009 10:41:20 GMT
Content-Length: 100
Date: Sat, 16 May 2009 10:41:20 GMT
Location: http://www.bioone.org/doi/pdf/10.1653/024.092.0101?cookieSet=1
[following]
--2009-05-16 19:41:20--
http://www.bioone.org/doi/pdf/10.1653/024.092.0101?cookieSet=1

Connecting to www.bioone.org|129.41.23.181|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Server: AtyponWS/7.1
Cache-Control: max-age=3600, private, must-revalidate
Pragma:
Content-Disposition: inline; filename=024%2E092%2E0101.pdf
ETag: "Fr/EqSodGZJ"
Last-Modified: Thu, 26 Mar 2009 19:17:39 GMT
Set-Cookie: SERVER=10.0.20.21:6095; path=/
Set-Cookie: JSESSIONID=abcvgkAzjNkeV9FOVajfs; path=/
Content-Type: application/pdf
Content-Length: 60486
Date: Sat, 16 May 2009 10:41:20 GMT
Length: 60486 (59K) [application/pdf]
Saving to: `024.092.0101?cookieSet=1'

Frank

Frank Bennett

unread,
May 16, 2009, 6:53:09 AM5/16/09
to zoter...@googlegroups.com
Just poking in the dark here, but as the browser is looking at the
site already during the scrape, it should have a session cookie. The
pdf URL might work in one go if you just tack the ?cookieSet=1 onto
the end of it. Worth a shot, anyway.

Frank

Rintze Zelle

unread,
May 16, 2009, 8:33:30 AM5/16/09
to zotero-dev
Nope, doesn't work.

Rintze

Nathan

unread,
May 24, 2009, 12:27:23 PM5/24/09
to zotero-dev
Do you have the "Automatically attach associated PDFs" option checked
in the preferences? I think at some point (on upgrade?) that option
became disabled for me, which was a source of confusion.

Nathan

Rintze Zelle

unread,
May 24, 2009, 2:41:41 PM5/24/09
to zotero-dev
Yes.

Rintze
Reply all
Reply to author
Forward
0 new messages