{ "translatorID": "625c6435-e235-4402-a48f-3095a9c1a09c", "label": "DBLP Computer Science Bibliography", "creator": "Adam Crymble, Sebastian Karcher, Philipp Zumstein", "target": "^https?://(www\\.)?(dblp(\\.org|\\.uni-trier\\.de/|\\.dagstuhl\\.de/)|informatik\\.uni-trier\\.de/\\~ley/)", "minVersion": "1.0.0b4.r5", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsv", "lastUpdated": "2014-04-03 16:48:03" } function detectWeb(doc, url) { if (url.indexOf('rec/bibtex') !== -1) { if (url.indexOf('journals') !== -1) { return "journalArticle"; } else if (url.indexOf('conf') !== -1) { return "conferencePaper"; } else if (url.indexOf('series') !== -1 || url.indexOf('reference') !== -1) { return "bookSection"; } else if (url.indexOf('books') !== -1) { return "book"; } else if (url.indexOf('phd') !== -1) { return "thesis"; } else { //generic fallback return "journalArticle"; } } else if ((url.match(/\/db\/(journals|conf|series|reference)/) || url.match(/\/pers\/(hd|ht|hy)/)) && !url.match(/index[\w-]*\.html/)) { return "multiple" } } function scrape(doc, url) { var xPathAllData = doc.evaluate('//pre', doc, null, XPathResult.ANY_TYPE, null); var firstData = xPathAllData.iterateNext(); //only if exists var firstDataText = firstData.textContent.replace(/ ee\s*=/, " url ="); //e.g. ee = {http://dx.doi.org/10.1007/978-3-319-00035-0_37}, Zotero.debug(firstDataText); //conferencePapers and bookSections are linked in DBLP //with the crossref field to the second BibTeX entry //for the proceeding or book. In these cases the following //lines (if-part) are handling the second entry and extracting //relevant fields and save it (later) to the main entry. var secondData; if (secondData = xPathAllData.iterateNext()) { var secondDataText = secondData.textContent; Zotero.debug(secondDataText); var trans = Zotero.loadTranslator('import'); trans.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');//https://github.com/zotero/translators/blob/master/BibTeX.js trans.setString(secondDataText); trans.setHandler('itemDone', function (obj, item) { scrapeMainPart(firstDataText, item); }); trans.translate(); } else { //if there are no secondData: scrape without additional data scrapeMainPart(firstDataText, null); } } function scrapeMainPart(firstDataText, secondDataItem) { //scrape from the firstDataText and if secondDataItem //is not null, add/update these information var trans = Zotero.loadTranslator('import'); trans.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');//https://github.com/zotero/translators/blob/master/BibTeX.js trans.setString(firstDataText); trans.setHandler('itemDone', function (obj, item) { Zotero.debug("item.itemType = " + item.itemType); if (secondDataItem) { if (secondDataItem.title && item.itemType == "conferencePaper") item.proceedingsTitle = secondDataItem.title; if (secondDataItem.title && item.itemType == "bookSection") item.booktitle = secondDataItem.titel; if (secondDataItem.creators && secondDataItem.creators.length > 0) item.creators = item.creators.concat(secondDataItem.creators); if (secondDataItem.publisher && !item.publisher) item.publisher = secondDataItem.publisher; if (secondDataItem.series && !item.series) item.series = secondDataItem.series; if (secondDataItem.volume && !item.volume) item.volume = secondDataItem.volume; if (secondDataItem.ISBN && !item.ISBN) item.ISBN = secondDataItem.ISBN; } //Assume that the url contains an doi. If the item does not //yet contain a doi, then save the doi and delete the url. //If the item contains the doi corresponding to the url //then just delete the url and keep the doi. if(item.url && item.url.search(/^https?:\/\/(?:dx\.)?doi\.org\/10\./i) != -1) { var doi = ZU.cleanDOI(item.url); if(doi && (!item.DOI || item.DOI == doi)) { item.DOI = doi; delete item.url; } } item.complete(); }); trans.translate(); } function doWeb(doc, url) { if (detectWeb(doc, url) == "multiple") { var items = new Object(); var articles = new Array(); var rows = ZU.xpath(doc, '//body/ul/li|//li[contains(@class, "entry")]') for(var i=0; i