zotero/translators — pull request #406 by aurimasv (2012-06-29 00:29:30+00:00)
Title: [APA PsycNET] several improvements

Trying to fetch RIS file on the very first attempt from the page fails. Basically, if your cookies are cleared, you follow a permanent link to an article, and then try to fetch it with Zotero, PsycNET doesn't return a RIS file. I think that is the major source of "line.replace is not a function" errors that are reported for this translator. We now retry once to allow cookies/session to be set up properly.

Detect more pages and pull IDs from them to fetch RIS data. I don't think the pages that are directed to by DOI resolver were being handled (at least not on the unpaid version). We can now scrape those pages, but it depends largely on being able to figure out the item ID, which is currently retrieved from all sorts of fragile places. I'm not sure if all of those methods will work on paid version of PsycNET. At the very least, I don't think it breaks any previous behavior.

Improve scraping directly from page if IDs cannot be found (does not work with all the pages that we detect). Updated regexes. This is only used if we cannot figure out IDs. I'm not sure how often this would happen. It only applies to the first 4 test cases. Might be worth extending it to the other test cases, since ID retrieval for those pages is much more fragile.

Not tested with paid version of PsychNET.

TODO: add PDF retrieval for the paid version. Awaiting more data from users with access.

Related discussion at http://forums.zotero.org/discussion/23810/pdfs-do-not-import/