diff --git a/README.md b/README.md
index 247275ad..987153af 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,13 @@
+ [专利搜索网站Soopat](http://www.soopat.com/) -> [Snnopat.js](./translators/Soopat.js)
- [x] 搜索页面和单个专利页面信息抓取
- [x] PDF附件下载(需要登录,网站验证码可能会导致PDF下载失败)
++ [国家图书馆文津搜索](http://find.nlc.cn/) -> [Wenjin.js](./translators/Wenjin.js)
+ - [x] 抓取引文信息
+ - [x] 支持文献类型:图书,论文
++ [ProQuest 学位论文全文检索平台](http://www.pqdtcn.com/) -> [ProQuestCN Thesis.js](<./translators/ProQuestCN Thesis.js>)
+ - [x] 抓取引文信息
+ - [x] 支持文献类型:学位论文
+ - [x] PDF附件下载(需要账号或者IP具有下载权限)
## 📢 如何使用
@@ -43,7 +50,7 @@
**2 解压下载的压缩包,找到**translators**目录,将目录中的文件复制到 Zotero 的 translators 目录**
-![](https://s1.ax1x.com/2020/08/19/dlKtG6.png)
+![](https://s1.ax1x.com/2020/09/07/wnDwlV.jpg)
![](https://s1.ax1x.com/2020/08/19/dlM36S.png)
**3 更新 translator 信息,Firefox 和 Chrome 浏览器操作类似。下面以 Firefox 为例**
diff --git a/translators/ProQuestCN Thesis.js b/translators/ProQuestCN Thesis.js
new file mode 100644
index 00000000..fd61d8b0
--- /dev/null
+++ b/translators/ProQuestCN Thesis.js
@@ -0,0 +1,329 @@
+{
+ "translatorID": "c90ad4a0-fe8a-4697-b345-ae5d3714d1fd",
+ "label": "ProQuestCN Thesis",
+ "creator": "Yizhao Wan",
+ "target": "^https?://www.pqdtcn.com/",
+ "minVersion": "3.0",
+ "maxVersion": "",
+ "priority": 100,
+ "inRepository": true,
+ "translatorType": 4,
+ "browserSupport": "gcsbv",
+ "lastUpdated": "2020-09-07 01:24:40"
+}
+
+/*
+ ***** BEGIN LICENSE BLOCK *****
+
+ Copyright © 2020 Yizhao Wan, https://github.com/Zotero-CN/translators_CN
+
+ This file is part of Zotero.
+
+ Zotero is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Zotero is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Zotero. If not, see .
+
+ ***** END LICENSE BLOCK *****
+*/
+function detectWeb(doc, url) {
+ if (url.includes('/thesisDetails/')) {
+
+ return 'thesis';
+ }
+ else if (getSearchResults(doc,true)) {
+ return 'multiple';
+ }
+ return false;
+}
+
+function getSearchResults(doc, checkOnly) {
+ var items = {};
+ var found = false;
+ var rows = ZU.xpath(doc, "//div[@id='basic_search']/table[@class='table']");
+ if (checkOnly) {
+
+ return rows.length ? 'multiple' : false;
+ }
+ for (let i=0; i < rows.length; i++) {
+ //Z.debug(rows[0]);
+ let title = ZU.xpath(rows[i], ".//td[@colspan='3']/a")[0];
+ //Z.debug(title.innerText);
+ //let click = title.;
+ //Z.debug(click);
+ let href = title.getAttribute('href');
+ href = "http://www.pqdtcn.com/"+href;
+ //Z.debug(href);
+ title = ZU.trimInternal(title.textContent);
+ if (!href || !title) continue;
+ found = true;
+ items[href] = (i+1) + " " + title;
+ //Z.debug(items[href]);
+ }
+ return found ? items : false;
+}
+
+function doWeb(doc, url) {
+
+ if (detectWeb(doc, url) == "multiple") {
+ Zotero.selectItems(getSearchResults(doc, false), function (items) {
+ if (items) {
+ processURL(Object.keys(items));
+ }
+ });
+ }
+ else {
+ scrape(doc, url);
+ }//*[@id="summary"]/div/span
+}
+function processURL(urls) {
+ //Z.debug(urls);
+ var url = urls.pop();
+ //Z.debug(url);
+ //ZU.doGet(url, function(text) {
+ ZU.processDocuments(url,function(doc){
+ //Z.debug(text);
+ //var parser = new DOMParser();
+ //var doc = parser.parseFromString(text, "text/html");
+ //Z.debug(doc);
+ scrape(doc, url);
+ if (urls.length) {
+ processURL(urls);
+ }
+ })
+}
+function scrape(doc,url){
+ var newItem=new Zotero.Item('thesis');
+
+ var note=ZU.xpath(doc,"//div[@id='summary']/div/span");
+ if(note.length){
+ newItem.abstractNote=ZU.trimInternal(note[0].innerText);
+ }
+ var index=ZU.xpath(doc,"//div[@style='margin-top: 9px;']");
+
+ //将所有的信息合并在一起后根据关键词找到对应的信息
+ //但是如果某一个关键词是空的话,整个列表的结构会乱
+ /*if(index.length){
+ index=index[0].innerText.split("\n");
+ //index=index.filter((ele) => !ele.match(/^[\t]*$/));
+ Z.debug(index);
+
+ var title=index.filter((ele) => ele.startsWith("标题"));
+ if(title.length){
+ //Z.debug(title);
+ title=index[index.indexOf(title[0])+1];
+ newItem.title=ZU.trimInternal(title);
+ }
+ var authors=index.filter((ele) => ele.startsWith("作者"));
+ if(authors.length){
+ //Z.debug(authors);
+ var creators=[];
+ authors=index[index.indexOf(authors[0])+1];
+ authors=new Array(authors);
+ authors = handleName(authors,false);
+ //Z.debug(authors);
+ }
+ var supervisor=index.filter((ele) => ele.startsWith("导师"));
+ if(supervisor.length){
+ supervisor=index[index.indexOf(supervisor[0])+1];
+ //导师可能有多个,具体以什么符号分割还未核实
+ supervisor=supervisor.split(";");
+ //Z.debug(supervisor);
+ supervisor=handleName(supervisor,true);
+ //Z.debug(supervisor);
+ }
+ if(supervisor.length && authors.length){
+ newItem.creators=authors.concat(supervisor);
+ }
+
+ var language=index.filter((ele) => ele.startsWith("语言"));
+ if(language.length){
+ language=index[index.indexOf(language[0])+1];
+ newItem.language=ZU.trimInternal(language);
+ }
+ var university=index.filter((ele) => ele.startsWith("大学/机构"));
+ if(university.length){
+ university=index[index.indexOf(university[0])+1];
+ newItem.university=ZU.trimInternal(university);
+ }
+ var ISBN=index.filter((ele) => ele.startsWith("ISBN"));
+ if(ISBN.length){
+ ISBN=index[index.indexOf(ISBN[0])+1];
+ newItem.ISBN=ZU.trimInternal(ISBN);
+ }
+ var pages=index.filter((ele) => ele.startsWith("页数"));
+ if(pages.length){
+ pages=index[index.indexOf(pages[0])+1];
+ newItem.numPages=ZU.trimInternal(pages);
+ }
+
+ var date=index.filter((ele) => ele.startsWith("出版日期"));
+ if(date.length){
+ date=getNextItem(index,date[0]);
+ newItem.date=ZU.trimInternal(date);
+ }
+ var type=index.filter((ele) => ele.startsWith("学位"));
+ if(type.length){
+ type=getNextItem(index,type[0]);
+ newItem.thesisType=ZU.trimInternal(type);
+ }
+ var place=index.filter((ele) => ele.startsWith("出版国家"));
+ if(place.length){
+ place=getNextItem(index,place[0]);
+ newItem.place=ZU.trimInternal(place);
+ }
+
+ }*/
+
+ //分析发现,论文的关键词信息是固定的,可以直接通过索引号来实现对应信息的提取
+ //Z.debug(index);
+ //Z.debug(index[0].children);
+ if(index.length){
+ var title=index[0].children[1].innerText.split(":")[1];
+ if(title.length){
+ newItem.title=ZU.trimInternal(title);
+ }
+
+ var authors=index[0].children[2].innerText.split(":")[1];
+ //Z.debug(authors);
+ if(authors.length){
+ //Z.debug(authors);
+ authors=new Array(ZU.trimInternal(authors));
+ authors = handleName(authors,false);
+ //Z.debug(authors);
+ }
+ var supervisor=index[0].children[11].innerText.split(":")[1];
+ if(supervisor.length){
+
+ //导师可能有多个,具体以什么符号分割还未核实
+ supervisor=ZU.trimInternal(supervisor).split(";");
+ //Z.debug(supervisor);
+ supervisor=handleName(supervisor,true);
+ //Z.debug(supervisor);
+ }
+ if(supervisor.length || authors.length){
+ newItem.creators=authors.concat(supervisor);
+ }
+
+ var pages=index[0].children[3].innerText.split(":")[1];
+ if(pages.length){
+ newItem.numPages=ZU.trimInternal(pages);
+ }
+
+ var date=index[0].children[4].innerText.split(":")[1];
+ if(date.length){
+ newItem.date=ZU.trimInternal(date);
+ }
+
+ var university=index[0].children[6].innerText.split(":")[1];
+ if(university.length){
+ newItem.university=ZU.trimInternal(university);
+ }
+
+ var place=index[0].children[9].innerText.split(":")[1];
+ if(place.length){
+ newItem.place=ZU.trimInternal(place);
+ }
+
+ var ISBN=index[0].children[10].innerText.split(":")[1];
+ if(ISBN.length){
+ newItem.ISBN=ZU.trimInternal(ISBN);
+ }
+
+ var type=index[0].children[13].innerText.split(":")[1];
+ if(type.length){
+ newItem.thesisType=ZU.trimInternal(type);
+ }
+
+ var language=index[0].children[14].innerText.split(":")[1];
+ if(language.length){
+ newItem.language=ZU.trimInternal(language);
+ }
+
+
+ var webType = detectWeb(doc, url);
+ if (webType && webType != 'multiple') {
+ var domain="http://www.pqdtcn.com/";
+ //var domain="http://2253809.rm.cglhub.com/"
+ ZU.doGet(domain+"thesis/downloadControl",function(text){
+ Z.debug(domain+"thesis/downloadControl");
+ Z.debug(text);
+ //succ=text.split(",")[0].split(":")[1];
+
+ //Z.debug(succ);
+ if(!text.length){
+ newItem.url = url;
+ newItem.complete();
+ return;
+ }
+ var data=JSON.parse(text);
+
+ //accesToken=text.split(",")[1].split(":")[1];
+ //accesToken=accesToken.slice(1,accesToken.length-2);
+ accesToken=data.accessToken;
+
+ var code=(ZU.xpath(doc,"//input[@id='thesisEncryptCode']"))[0].getAttribute("value");
+ var sites = ZU.xpath(doc,"//li[@role='presentation']");
+ //获取可供下载pdf的服务器编号
+ var remoteSites=[];
+ if(sites.length){
+ for (let site of sites){
+ //Z.debug(site.innerText);
+ remoteSites.push(site.getElementsByTagName("a")[0].getAttribute("value"));
+ }
+ }
+ if(!remoteSites.length){
+ newItem.url = url;
+ newItem.complete();
+ return;
+ }
+ Z.debug(remoteSites);
+ var pdfurl=domain+"thesis/download/"+remoteSites[Math.floor(Math.random()*remoteSites.length)]+"/"+code+"?accessToken="+accesToken;
+ //Z.debug(pdfurl);
+
+ var attachments = [];
+ Z.debug(pdfurl);
+ if (pdfurl) {
+ newItem.attachments.push({
+ title: "Full Text PDF",
+ mimeType: "application/pdf",
+ url: pdfurl
+ });
+ }
+ newItem.url = url;
+ newItem.complete();
+ })
+ }
+ }
+
+}
+function getNextItem(index,item){
+ return index[index.indexOf(item)+1];
+}
+function handleName(authors,isContri){
+ var creators=[];
+ for (let author of authors) {
+
+ var creator = {};
+ var lastSpace = author.lastIndexOf(',');
+ if (author.search(/[A-Za-z]/) !== -1 && lastSpace !== -1) {
+ // English
+ creator.lastName = author.slice(0, lastSpace);
+ creator.firstName = author.slice(lastSpace+1);
+ }
+ if(isContri){
+ creator.creatorType = "contributor";
+ }
+ }
+ creators.push(creator);
+ //Z.debug(creators);
+ return creators;
+}
diff --git a/translators/Wenjin.js b/translators/Wenjin.js
new file mode 100644
index 00000000..6d92f7f2
--- /dev/null
+++ b/translators/Wenjin.js
@@ -0,0 +1,463 @@
+{
+ "translatorID": "f306107f-dabb-41ac-8fa2-f7f858feb11f",
+ "label": "Wenjin",
+ "creator": "Xingzhong Lin",
+ "target": "https?://find.nlc.cn/search",
+ "minVersion": "3.0",
+ "maxVersion": "",
+ "priority": 100,
+ "inRepository": true,
+ "translatorType": 4,
+ "browserSupport": "gcsibv",
+ "lastUpdated": "2020-08-29 14:11:42"
+}
+
+/*
+ ***** BEGIN LICENSE BLOCK *****
+
+ Copyright © 2020 Xingzhong Lin, https://github.com/Zotero-CN/translators_CN
+
+ This file is part of Zotero.
+
+ Zotero is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Zotero is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Zotero. If not, see .
+
+ ***** END LICENSE BLOCK *****
+*/
+
+function processURL(urls) {
+ //Z.debug(urls);
+ var url = urls.pop();
+ //Z.debug(url);
+ //ZU.doGet(url, function(text) {
+ ZU.processDocuments(url,function(doc){
+ //Z.debug(text);
+ //var parser = new DOMParser();
+ //var doc = parser.parseFromString(text, "text/html");
+ //Z.debug(doc);
+ scrape_multiple(doc, url);
+ if (urls.length) {
+ processURL(urls);
+ }
+ })
+}
+
+function detectWeb(doc, url) {
+ if (url.includes('/search/showDocDetails')) {
+
+ return detectType(doc);
+ }
+ else if (url.includes("search/doSearch?query")) {
+ return 'multiple';
+ }
+ return false;
+}
+
+function detectType(doc) {
+ var itemType = {
+ 普通古籍: "book",
+ 善本: "book",
+ 学位论文: "thesis",
+ 特藏古籍: "book",
+ 期刊论文:"journalArticle",
+ 期刊: "journalArticle",
+ 报纸: "newspaperArticle",
+ 专著: "book",
+ 报告: "report"
+ };
+ var type = ZU.xpath(doc, "//span[@class='book_val']");
+ if (type.length) {
+ Z.debug(type[0].textContent);
+ return itemType[type[0].textContent];
+ } else {
+ return false;
+ }
+}
+
+
+function getSearchResults(doc, checkOnly) {
+ var items = {};
+ var found = false;
+ var rows = ZU.xpath(doc, "//div[@class='article_item']");
+ Z.debug(rows.length);
+ if (checkOnly) {
+ return rows.length ? 'multiple' : false;
+ }
+ for (let i=0; i < rows.length; i++) {
+ //Z.debug(rows[i])
+ let title = ZU.xpath(rows[i], ".//div[@class='book_name']/a")[0];
+ //Z.debug(title.textContent);
+ let click = title.getAttribute('onclick').split("'");
+ //Z.debug(click);
+ let href = "http://find.nlc.cn/search/showDocDetails?docId="
+ + click[3]
+ + "&dataSource="
+ + click[5]
+ + "&query="
+ + encodeURI(click[7]);
+ Z.debug(href);
+ title = ZU.trimInternal(title.textContent);
+ if (!href || !title) continue;
+ found = true;
+ items[href] = (i+1) + " " + title;
+ //Z.debug(items[href]);
+ }
+ return found ? items : false;
+}
+
+function doWeb(doc, url) {
+
+ if (detectWeb(doc, url) == "multiple") {
+ Zotero.selectItems(getSearchResults(doc, false), function (items) {
+ if (items) {
+ //Z.debug(items);
+ //items的keys是网址
+ //items的value是title
+ //Object.keys返回items对象可枚举属性的字符串数组,传入对象,返回属性名即网址
+ processURL(Object.keys(items));
+ }
+ });
+ }
+ else {
+ scrape(doc, url);
+ }
+}
+
+function scrape(doc, url) {
+
+ var type = detectType(doc);
+ var newItem = new Zotero.Item(type);
+ var detailA = ZU.xpath(doc, "//div[@class='book_wr']")[0].innerText;
+ Z.debug(detailA);
+ //Z.debug(detailA.replace(/\s*/g,""));
+ var detailB = ZU.xpath(doc, "//div[@id='detail-info']")[0].innerText;
+ Z.debug(detailB);
+ var details = (detailA + "\n" + detailB).split("\n");
+ Z.debug(details);
+ var title = ZU.trimInternal(details[0]);
+
+ //Z.debug(title);
+ newItem.title = title;
+ var date = details.filter((ele) => ele.startsWith("出版发行时间:") || ele.startsWith("论文授予时间"));
+
+ if (date.length) {
+ newItem.date = ZU.trimInternal(date[0].split(":")[1]);
+
+ }
+ var tags = details.filter((ele) => ele.startsWith("关键词"));
+ if (tags.length) {
+
+ newItem.tags = ZU.trimInternal(tags[0]).split(": ")[1].split(/[ -;]/);
+ }
+ var tagsEN = details.filter((ele) => ele.startsWith("英文关键词"));
+ if (tagsEN.length) {
+ newItem.tags = ZU.trimInternal(tagsEN[0]).split(": ")[1].split(/;/);
+ }
+ var place = details.filter((ele) => ele.startsWith("出版、发行地"));
+ if (place.length) {
+ newItem.place = place[0].split(": ")[1];
+ }
+ var pages = details.filter((ele) => ele.startsWith("载体形态") || ele.startsWith("页 :"));
+
+ if (pages.length) {
+ if(type==="book" || type === "thesis")//book和thesis的tiem中页数的关键词是numPages,其他类型是pages
+ newItem.numPages = pages[0].split(": ")[1].replace("页", "");
+
+ else
+ {
+ newItem.pages = pages[0].split(": ")[1].replace("页", "");
+ }
+ }
+ var publisher = details.filter((ele) => ele.startsWith("出版、发行者"));
+ if (publisher.length) {
+ newItem.publisher = publisher[0].split(": ")[1];
+ }
+ var authors = details.filter((ele) => ele.startsWith("所有责任者") || ele.startsWith("作者:"));
+ Z.debug(authors);
+ if (authors.length) {
+ if (authors[0].search(/[A-Za-z]/) !== -1) {
+ authors = authors[authors.length-1].split(": ")[1].split(/[;|,]/)
+ } else {
+ authors = authors[authors.length-1].split(": ")[1].split(/[\s,;]+/) // Special comma
+ //Z.debug(authors);
+ }
+ newItem.creators = handleName(authors);
+ //Z.debug(authors);
+ }
+
+ var language= details.filter((ele) => ele.startsWith("语种"));
+ Z.debug(language);
+ if(language.length){
+ newItem.language=language[0].split(":")[1];
+ }
+
+ var note=ZU.xpath(doc, "//div[@class='zy_pp_val']");
+ //Z.debug(note);
+ if(note.length){
+ //Z.debug("test");
+ if(note[0].innerText.length){
+ newItem.abstractNote=ZU.trimInternal(note[0].innerText);
+ }
+ }
+
+ var university = details.filter((ele) => ele.startsWith("论文授予机构"));
+ if (university.length) {
+ newItem.university = university[0].split(": ")[1];
+ }
+ var abstract = details.filter((ele) => ele.startsWith("引文"));
+ if (abstract.length) {
+ newItem.abstractNote = abstract[0].split(":")[1];
+ }
+ var issue = details.filter((ele) => ele.startsWith("期"));
+ if (issue.length) {
+ newItem.issue = issue[0].split(":")[1];
+ }
+ var publication = details.filter((ele) => ele.startsWith("来源:"));
+ if (publication.length) {
+ var tmp = publication[0].split(": ")[1].split(/,/);
+ newItem.publication = tmp[0];
+ tmp.length > 2 ? newItem.journalAbbreviation = tmp[1] : false;
+ }
+ var ISSN = details.filter((ele) => ele.startsWith("标识号"));
+ if (ISSN.length) {
+ newItem.ISBN = ISSN[0].split(": ")[1];
+ }
+ newItem.url = url;
+ newItem.complete();
+}
+
+function scrape_multiple(doc,url){
+
+ //因multiple情况下使用doGet返回的doc与single情况下不同,故单独处理
+ var type = detectType(doc);
+ var newItem = new Zotero.Item(type);
+ var detailA = ZU.xpath(doc, "//div[@class='book_wr']")[0].innerText;
+ //Z.debug(detailA);
+ //Z.debug(detailA.replace(/\ +/g,""));
+ var detailB = ZU.xpath(doc, "//div[@id='detail-info']")[0].innerText;
+ //Z.debug(detailB);
+ var details = (detailA + "\n" + detailB).split("\n");
+ //Z.debug(details.filter((ele) => !ele.match(/^[ ]*$/)));
+ details=details.filter((ele) => !ele.match(/^[ ]*$/));
+ details=details.filter((ele) => !ele.match(/^[ \t]*$/));
+ details=details.filter((ele) => !ele.match(/^[ :]*$/));
+
+ Z.debug(details);
+ var title = ZU.trimInternal(details[0]);
+ //Z.debug(title);
+ newItem.title = title;
+ //var date = details.filter((ele) => ele.startsWith("出版发行时间:") || ele.startsWith("论文授予时间"));
+ var date=details[details.indexOf("出版发行时间:"||"论文授予时间")+1];
+ //Z.debug(date);
+ if (date.length) {
+ //newItem.date = ZU.trimInternal(date[0].split(":")[1]);
+ newItem.date=ZU.trimInternal(date);
+ }
+ var tags=details.filter((ele) => ele.endsWith("关键词"))[0];
+ if (tags.length) {
+ tags = details[details.indexOf(tags)+1];
+ newItem.tags = ZU.trimInternal(tags).split(/[ -|;]/);
+ }
+
+ var tagsEN = details.filter((ele) => ele.startsWith("英文关键词"));
+ if (tagsEN.length) {
+ newItem.tags = ZU.trimInternal(tagsEN[0]).split(": ")[1].split(/;/);
+ }
+ var place = details.filter((ele) => ele.endsWith("出版、发行地"));
+ if (place.length) {
+ place=details[details.indexOf(place[0])+1];
+ newItem.place = ZU.trimInternal(place);
+ }
+ //var pages = details.filter((ele) => ele.startsWith("载体形态") || ele.startsWith("页 :"));
+ var pages=details.filter((ele) => ele.endsWith("载体形态") || ele.endsWith("页 :"));
+ Z.debug(pages);
+ if (pages.length) {
+ pages=details[details.indexOf(pages[0])+1];
+ newItem.pages = pages.replace("页", "");
+ }
+
+ var publisher = details.filter((ele) => ele.startsWith("出版、发行者"));
+ if (publisher.length) {
+ publisher=details[details.indexOf(publisher[0])+1];
+ newItem.publisher = ZU.trimInternal(publisher);
+ }
+
+ var authors = details.filter((ele) => ele.endsWith("所有责任者") || ele.startsWith("作者:"));
+ //Z.debug(authors);
+ authors=details[details.indexOf(authors[0])+1];
+ //Z.debug(authors);
+ if (authors.length) {
+ if (authors.search(/[A-Za-z]/) !== -1) {
+ authors = authors.split(/;/)
+ } else {
+ authors = authors.split(/[\s,;]+/) // Special comma
+ //Z.debug(authors);
+ }
+ newItem.creators = handleName(authors);
+ //Z.debug(authors);
+ }
+
+ var language= details.filter((ele) => ele.endsWith("语种"));
+ if(language.length){
+ language=details[details.indexOf(language[0])+1];
+ newItem.language=ZU.trimInternal(language);
+ }
+
+ var note=ZU.xpath(doc, "//div[@class='zy_pp_val']");
+
+ //Z.debug(note);
+ if(note.length){
+ if(note[0].innerText.length){
+ newItem.abstractNote=ZU.trimInternal(note[0].innerText);
+ }
+ }
+
+ var university = details.filter((ele) => ele.startsWith("论文授予机构"));
+ if (university.length) {
+ university=details[details.indexOf(university[0])+1];
+ newItem.university = ZU.trimInternal(university);
+ }
+ var abstract = details.filter((ele) => ele.startsWith("引文"));
+ if (abstract.length) {
+ newItem.abstractNote = abstract[0].split(":")[1];
+ }
+ var issue = details.filter((ele) => ele.startsWith("期"));
+ if (issue.length) {
+ newItem.issue = issue[0].split(":")[1];
+ }
+ var publication = details.filter((ele) => ele.startsWith("来源:"));
+ if (publication.length) {
+ var tmp = publication[0].split(": ")[1].split(/,/);
+ newItem.publication = tmp[0];
+ tmp.length > 2 ? newItem.journalAbbreviation = tmp[1] : false;
+ }
+ var ISBN = details.filter((ele) => ele.endsWith("标识号"));
+ //Z.debug(ISBN);
+ ISBN=details[details.indexOf(ISBN[0])+1];
+ if (ISBN.length) {
+ //Z.debug(ISBN);
+ Z.debug(ISBN.split(':')[1]);
+ newItem.ISBN = (ISBN.split(':')[1]);
+ }
+ newItem.url = url;
+ newItem.complete();
+}
+
+
+function handleName(authors) {
+ // 有英文
+ var creators = [];
+ for (let author of authors) {
+ var creator = {};
+ var lastSpace = author.lastIndexOf(' ');
+ if (author.search(/[A-Za-z]/) !== -1 && lastSpace !== -1) {
+ // English
+ creator.firstName = author.slice(0, lastSpace);
+ creator.lastName = author.slice(lastSpace+1);
+
+ } else {
+ // Chinese
+ if (authors.indexOf(author) > -1) {
+
+ //if (author.endsWith("等") || author.endsWith("著")) {
+ // author = author.slice(0, author.length -1);
+ //作者姓名可能以"等"、"等编"、"编著"、"主编"、"著"这几种形式结尾
+ if (author.indexOf("等") !==-1) {
+ author=author.slice(0,author.indexOf("等"));
+ //Z.debug(author);
+ // 去除等或著后与其他姓名重名,跳过
+ if (authors.indexOf(author) > -1) {
+ continue;
+ }
+ }
+ else if(author.indexOf("主") !==-1){
+ author=author.slice(0,author.indexOf("主"));
+ if (authors.indexOf(author) > -1) {
+ continue;
+ }
+ }
+ else if(author.indexOf("编") !==-1){
+ author=author.slice(0,author.indexOf("编"));
+ if (authors.indexOf(author) > -1) {
+ continue;
+ }
+ }
+ else if(author.indexOf("著") !==-1){
+ author=author.slice(0,author.indexOf("著"));
+ if (authors.indexOf(author) > -1) {
+ continue;
+ }
+ }
+
+
+
+ }
+ //Z.debug(author);
+ creator.firstName = author.slice(1);
+ creator.lastName = author.charAt(0);
+ if (author.endsWith("指导")) {
+ creator.creatorType = "contributor";
+ }
+ }
+ creators.push(creator);
+ }
+ return creators;
+}
+// TEST URL
+// http://find.nlc.cn/search/showDocDetails?docId=7225006674714026291&dataSource=ucs01,bslw&query=%E4%BF%A1%E7%94%A8
+// http://find.nlc.cn/search/showDocDetails?docId=-8373230212045865087&dataSource=cjfd&query=wgcna
+// http://find.nlc.cn/search/showDocDetails?docId=6614677564794870987&dataSource=wpqk&query=wgcna
+/** BEGIN TEST CASES **/
+var testCases = [
+ {
+ "type": "web",
+ "url": "http://find.nlc.cn/search/showDocDetails?docId=-4203196484494800823&dataSource=ucs01&query=%E6%B0%B4%E5%90%88%E7%89%A9",
+ "items": [
+ {
+ "itemType": "book",
+ "title": "天然气水合物气藏开发",
+ "creators": [
+ {
+ "fistName": "平",
+ "lastName": "郭"
+ },
+ {
+ "fistName": "士鑫",
+ "lastName": "刘"
+ },
+ {
+ "fistName": "建芬",
+ "lastName": "杜"
+ }
+ ],
+ "date": "2006",
+ "libraryCatalog": "Wenjin",
+ "place": "北京",
+ "publisher": "石油工业出版社",
+ "url": "http://find.nlc.cn/search/showDocDetails?docId=-4203196484494800823&dataSource=ucs01&query=%E6%B0%B4%E5%90%88%E7%89%A9",
+ "attachments": [],
+ "tags": [
+ {
+ "tag": "天然气水合物"
+ },
+ {
+ "tag": "气田开发"
+ }
+ ],
+ "notes": [],
+ "seeAlso": []
+ }
+ ]
+ }
+]
+/** END TEST CASES **/