Authors/Creators missing from SAE Papers translator

Hello!

It seems that the SAE Paper translator does not work properly. When adding a paper to Zotero, (e.g. papers.sae.org/2005-01-0026/) author is missing, and it is treated as a webpage, instead of a report. The DOI translator gets the author though.

I tried to play with the .js code, trying to use the DOI for the author, but I was unsuccessful at it - I am not familiar with the various functions and libraries of Zotero.

I tried the following (Going the DOI route), but it does not work (it does not crash at least):
var DOI = ZU.xpathText(doc, '//meta[@name="citation_doi"]/@content');
var newItemCR = new Zotero.Item("journalArticle");
var translateSearch = Zotero.loadTranslator("search");
// CrossRef
translateSearch.setTranslator("11645bd1-0420-45c1-badb-53fb41eeb753");
var itemCrossRef = {"DOI": DOI};
translateSearch.setSearch(itemCrossRef);
translateSearch.setHandler("itemDone", function(obj, itemCrossRef) {
newItemCR.creators = itemCrossRef.creators;
});
translateSearch.setHandler("done", function() {
newItemCR.complete();
});
var authors2=newItemCR.creators;

Thanks for your help.
  • I'll take a look. The authors are on that page (in the header) where they're supposed to be, so not sure why they wouldn't import (and why this imports as a webpage)
  • Hello, I am wondering if there are any updates on this issue...
    Maybe as a workaround, what piece of code would get me the authors from CrossRef DOI Search?

    Thanks!
  • edited April 28, 2016
    Note that you can just import using CrossRef, i.e. click on the arrow next to the Zotero icon and select "Save to Zotero using DOI".

    That said, the page is rather shockingly broken. If you look at the W3C validator, it doesn't just report dozens of errors, it actually hangs up:
    https://validator.w3.org/nu/?doc=http%3A%2F%2Fpapers.sae.org%2F2005-01-0026%2F#textarea

    The reason is actually the same as for Zotero's failure to import this properly: the javascript code that's labeled as "Qualtrics Site Intercept" causes an implicit body tag to be inserted by Firefox to read the page. As a consequence, the metadata is in the body and Zotero doesn't see it anymore. I don't know enough about webdesign to be able to say more than that that looks very bad on their end (maybe Dan is curious enough to look -- he'd know). I'm not sure we can easily -- or should, for that matter -- fix this.
  • I actually managed to tweak the original SAE translator so that it turns it into a journal article (not a report) instead of a web page, and it has most of the metadata I need except the authors. I hard code that it is a journal article (not pretty, I know), I reuse whatever the basic data the default translator gets (like the title), and for the rest I do a text search. For example, to get the abstract:
    var abstract = ZU.xpathText(doc, '//div[@class="dt-scope" and div/div[contains(text(), "Abstract")]]//div[@class="dt-scope-c-content"]');

    What I cannot do is to get the authors. A similar approach to above fails - I assume that it outputs a string, and a creator in Zotero is a more complex structure.

    So my question is how do I get the authors from that page? Or is there a function to convert a string with author names into a "creator" structure/class?

    PS: I prefer to use the customized SAE translator, as I get more metadata than from Crossref.
  • var authors = ZU.xpath(doc, '//meta[@name="citation_author"]');
    for (var i = 0; i<authors.length; i++){
    newItem.Zotero.push(ZU.cleanAuthor(authors[i], "author"));
    }


    Just wrote this from memory, might need slight tweaking.

  • I tried the code below, and it worked. Thanks for your help!



    var authors = ZU.xpath(doc, '//meta[@name="citation_author"]/@content');
    for (var i = 0; i<authors.length;i++){
    newItem.creators[i]=ZU.cleanAuthor(authors[i].textContent, "author");
    }
  • (in my code that should have bee newItem.creators.push and I was missing the textContent; with those changes, the two are equivalent).
Sign In or Register to comment.