From d8c298c8ff7c0f344476d67e08d873c2fdecfd3b Mon Sep 17 00:00:00 2001 From: jiaojiaodubai <63148861+jiaojiaodubai@users.noreply.github.com> Date: Thu, 23 May 2024 12:23:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=AF=B9VPN=E5=BC=82?= =?UTF-8?q?=E5=BD=A2=E7=BD=91=E5=9D=80=E7=9A=84=E6=94=AF=E6=8C=81=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8B=B1=E6=96=87=E6=A0=87=E9=A2=98=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E6=97=A0=E6=B3=95=E6=8A=93=E5=8F=96=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8A=A5=E5=91=8A=E7=BC=BA=E5=AD=97=E6=AE=B5fix=20#34?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wanfang Data.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Wanfang Data.js b/Wanfang Data.js index 4b63b9d..ff305cf 100644 --- a/Wanfang Data.js +++ b/Wanfang Data.js @@ -2,14 +2,14 @@ "translatorID": "eb876bd2-644c-458e-8d05-bf54b10176f3", "label": "Wanfang Data", "creator": "Ace Strong , rnicrosoft", - "target": "^https?://.*(d|s)(\\.|-)wanfangdata(\\.|-)com(\\.|-)cn", + "target": "^https?://.*(d|s)\\.wanfangdata\\.com\\.cn", "minVersion": "2.0rc1", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2024-04-17 12:08:54" + "lastUpdated": "2024-05-23 04:15:55" } /* @@ -108,7 +108,7 @@ class ID { } function detectWeb(doc, url) { - Z.debug("--------------- WanFang Data 2024-04-17 20:05:50 ---------------"); + Z.debug("--------------- WanFang Data 2024-05-23 12:19:10 ---------------"); let dynamic = doc.querySelector('.container-flex, .periodical'); if (dynamic) { Z.monitorDOMChanges(dynamic, { childList: true }); @@ -172,9 +172,6 @@ async function scrapePage(doc, url = doc.location.href) { Z.debug(labels.innerData.map(arr => [arr[0], ZU.trimInternal(arr[1].textContent)])); let extra = new Extra(); let newItem = new Zotero.Item(ids.itemType); - // .detailTitleCN中可能会含Easy Scholar的标签,es方面已计划修复 - newItem.title = text(doc, '.detailTitleCN > span:first-child') || text(doc, '.detailTitleCN'); - extra.set('original-title', ZU.capitalizeTitle(text(doc, '.detailTitleEN')), true); // span.abstractIcon.btn:摘要的详情按钮,多见于学位论文 // .moreFlex > span:first-child:英文信息的展开按钮 let clickMore = Array.from(doc.querySelectorAll('span.abstractIcon.btn, .moreFlex > span:first-child')); @@ -182,6 +179,9 @@ async function scrapePage(doc, url = doc.location.href) { let buttonText = button.getAttribute('title') || button.innerText; if (!buttonText.includes('收起')) await button.click(); } + // .detailTitleCN中可能会含Easy Scholar的标签,es方面已计划修复 + newItem.title = text(doc, '.detailTitleCN > span:first-child') || text(doc, '.detailTitleCN'); + extra.set('original-title', ZU.capitalizeTitle(text(doc, '.detailTitleEN')), true); newItem.abstractNote = ZU.trimInternal(text(doc, '.summary > .item+*')); doc.querySelectorAll('.author.detailTitle span').forEach((elemant) => { newItem.creators.push(cleanAuthor(elemant.innerText.replace(/[\s\d,]*$/, ''), 'author')); @@ -237,17 +237,26 @@ async function scrapePage(doc, url = doc.location.href) { extra.set('Genre', text(doc, '.patentType > .itemUrl'), true); break; case 'report': - newItem.abstractNote = text(doc, '.abstract > .itemUrl'); + if (ids.dbname == 'cstad') { + newItem.abstractNote = text(doc, '.abstract > .itemUrl'); + } // 成果报告 newItem.reportNumber = text(doc, '.id > .itemUrl'); + newItem.language = labels.getWith('语种') == 'eng' + ? 'en-US' + : 'zh-CN'; newItem.reportType = { - nstr: '科技报告', - cstad: '成果报告' + nstr: newItem.language == 'en-US' + ? 'Science and technology report' + : '科技报告', + cstad: newItem.language == 'en-US' + ? 'Achievement report' + : '成果报告' }[ids.dbname]; // 成果报告 newItem.institution = text(doc, '.organization > .itemUrl'); // .publishYear > .itemUrl:成果报告 - newItem.date = text(doc, '.preparationTime > .itemUrl, .publishYear > .itemUrl'); + newItem.date = text(doc, '.preparationTime > .itemUrl, .publishYear > .itemUrl, .approvalDate > .itemUrl'); newItem.archiveLocation = text(doc, '.libNum > .itemUrl'); extra.set('project', text(doc, '.projectName > .itemUrl')); // 成果报告 @@ -291,7 +300,7 @@ async function scrapePage(doc, url = doc.location.href) { } newItem.url = ids.url; extra.set('CLC', text(doc, '.classify > .itemUrl, .classCodeMapping > .itemUrl')); - doc.querySelectorAll('.keyword > .item+* > a').forEach((element) => { + doc.querySelectorAll('.keyword > .item+* > a, .keywordEN > .item+* > a').forEach((element) => { newItem.tags.push(element.innerText); }); addAttachment(doc, newItem);