CNKI PDF RIS Helper

1.支持在论文详情页直接导出RIS, 一键导入Endnote! 参考:https://blog.cuger.cn/p/5187/

Skript installieren?
Vom Ersteller vorgeschlagenes Skript

Ihnen könnte auch SCI RIS Helper - EndNote+Scihub gefallen.

Skript installieren
// ==UserScript==
// @name         CNKI PDF RIS Helper
// @namespace    https://blog.cuger.cn/p/5187/
// @version      0.7.4
// @description  1.支持在论文详情页直接导出RIS, 一键导入Endnote! 参考:https://blog.cuger.cn/p/5187/
// @author       Dorad
// @license      MIT License
// @connect      cuger.cn
// @connect      kns.cnki.net
// @connect      docdown.cnki.net
// @connect      pdf.oversea.d.cnki.net
// @connect      bar.cnki.net
// @include      http*cnki.net*
// @include      http*cnki*edu.cn*
// @run-at       document-idle
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.slim.min.js
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAACACAYAAADTcu1SAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAADqqSURBVHhe7Z0HdFTF18Dntd1N771DEtIDhJ5A6KRQpAkqRZoIoghS7IqCBVBUUFCaSFFBeu89EEpCCkkghYT0sunbXptvZlkikfQABr//75yc7M4r+97cuXfunUqA55BIfxMzATIBJCH2hoAYCgjoitMpkhEYiQRSDE2QgCQggECEoihwLOBYDSlCSKIXLkfJhwEgLgBauKUwLs89fx7w2hs/hzwXAozsaOkhCGIkRRC9zK3tO7l5+Tk6t+tA2bu0g1Z2TsDSxh6YW9tCGkmPomhIEPi9HrwahEiMCFHgQcL1y1Vfzp9siIRJaQ9qgdUQgFgk1CgoEruP3ZZf1x14LmjTAhzib9GBpqgfArqGhIYMGUF06tUfC0uiO9wksPByM9P4I39sFI/v/k0iCHzD7wzhIQIIkw4nVJTpUto0bVaAEb7m3g7tPC4uXrnJ2Nndi9ElN8qJPds02ekpgGU1sLQ4n0pPjgelRQU115MkiWVK9A4frdA3MGQKc7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upw7/pamorOAeFRyyk/ylM0c0CyZHViLvb/WIQBNT3aX/b2iTdeA/CfMzDSAIajpF0aG2Ti5OxqYWemqVojg3My2F02hOAoHceiSp+JmMAmtbAPB/yfWzs5iHa/wAAAAASUVORK5CYII=
// @grant        GM_downlaod
// @grant        GM_xmlhttpRequest
// ==/UserScript==
"use strict";
(async function () {
    console.log('CNKI PDF RIS Helper --- Dorad, cug.xia@gmail.com');
    var site = window.location.href.toString().toLowerCase();
    if (site.indexOf('kcms/detail') != -1 || site.indexOf('kcms2/article') != -1) {
        // 详情页
        var butttonBoxs = document.getElementsByClassName('operate-btn');
        /*
         * RIS Export
         */
        // get fileId
        const fileId = document.getElementById('paramfilename').value;
        const dbCode = document.getElementById('paramdbcode').value;
        const dbName = document.getElementById('paramdbname').value;
        const title = document.getElementsByClassName('wx-tit')[0].children[0].text;
        var pdf = document.getElementById('pdfDown') ? document.getElementById('pdfDown').href : null;
        var paper = {
            dbName: document.getElementById('paramdbname').value,
            dbCode: document.getElementById('paramdbcode').value,
            fileId: document.getElementById('paramfilename').value,
            title: document.getElementsByClassName('wx-tit')[0].children[0].text,
        }
        if ((['CDFD', 'CMFD'].indexOf(dbCode) < 0 || document.domain.indexOf('oversea') > -1) && pdf !== null) {
            paper.pdf = pdf;
        }

        // get cache
        let paperCache = getSearchCache(fileId);
        // merge paper data
        if (paperCache && !paper.hasOwnProperty('pdf')) {
            paper = Object.assign(paper, paperCache);
        }
        console.log(paper);

        var risExportBtn = document.createElement('li');
        risExportBtn.setAttribute("class", "btn-dlpdf");
        risExportBtn.innerHTML = '<a><i></i>RIS</a>';
        risExportBtn.firstElementChild.style.backgroundColor = "#2f022e";
        /** RIS */
        var risExportBtnFixed = risExportBtn.cloneNode(true)
        var exportRisEvent = function () {
            downloadByFilename(fileId, dbName, title, 'EndNote');
        }
        risExportBtn.onclick = exportRisEvent;
        risExportBtnFixed.onclick = exportRisEvent;
        butttonBoxs[0].append(risExportBtn);
        butttonBoxs[1].append(risExportBtnFixed);
        /** RIS+ */
        if (paper.hasOwnProperty('pdf') && document.domain.indexOf('oversea') > -1) {
            let pdfUrl = await getPdfUrl(paper.pdf);
            if (pdfUrl !== null) {
                paper.pdfUrl = pdfUrl;
            }
            var risPlusExportBtnFixed = risExportBtn.cloneNode(true)
            risPlusExportBtnFixed.innerHTML = '<a><i></i>RIS+(test)</a>';
            var exportRisPlusEvent = function () {
                console.log('RIS+ Export: ' + title + ', ' + fileId + ', ' + dbName);
                // downloadRisOfPaper(paper);
                downloadByFilename(fileId, dbName, title, 'EndNote', paper.pdfUrl);
            }
            risPlusExportBtnFixed.onclick = exportRisPlusEvent;
            butttonBoxs[0].append(risPlusExportBtnFixed);
        }
        /** PDF button for Thesis */
        console.log(['CDFD', 'CMFD'].indexOf(dbCode) > -1 && paper.hasOwnProperty('pdf'));
        if (['CDFD', 'CMFD'].indexOf(dbCode) > -1 && paper.hasOwnProperty('pdf') && document.domain.indexOf('oversea') == -1) {
            var pdfDownloadBtn = risExportBtn.cloneNode(true)
            const pdfUrl = paper.pdf.indexOf('http') > -1 ? paper.pdf : "https://" + document.domain + paper.pdf;
            pdfDownloadBtn.innerHTML = "<a href=" + pdfUrl + " target='_blank'><i></i>PDF下载</a>";
            // pdfDownloadBtn.setAttribute("href", "https://"+document.domain+paper.pdf);
            butttonBoxs[0].append(pdfDownloadBtn);
        }

    } else if (site.indexOf('defaultresult/index') !== -1 || site.indexOf("advsearch") !== -1) {
        // 搜索页
        var wrapper = document.getElementsByClassName('wrapper')[0];
        var observer = new MutationObserver(function (changeList) {
            updateRowItems();
            // console.log(changeList);
        });
        observer.observe(wrapper, {
            attributes: true,
            subtree: true,
            characterData: true,
        });
    } else {
        console.log('不支持的页面. Dorad, cug.xia@gmail.com', site);
    }
})();

// 更新搜索页,每一行的【下载PDF】和【导出RIS】
function updateRowItems() {
    if (document.getElementsByClassName('result-table-list').length == 0) {
        return;
    }
    var table = document.getElementsByClassName('result-table-list')[0];
    var rows = table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
    let paperList = []
    for (var i = 0; i < rows.length; i++) {
        var row = rows[i];
        if (row.getAttribute('ris')) {
            continue;
        } else {
            let fileName = row.getElementsByClassName('seq')[0].firstElementChild.value;
            let dbName = fileName.split('!')[0];
            let fileId = fileName.split('!')[1];
            let title = row.getElementsByClassName('name')[0].firstElementChild.innerHTML.replace(/<[^>]*>|/g, "").replace(/(^\s+)|(\s+$)/g, "");
            let pdf = null;
            // console.log(title);
            var operats = row.getElementsByClassName('operat')[0];
            // replace the download with pdf
            if (operats.getElementsByClassName('downloadlink').length) {
                var downloadPdf = operats.getElementsByClassName('icon-download')[0];
                if (downloadPdf == null) {
                    console.log("产品未订阅: " + title)
                    continue
                }
                downloadPdf.setAttribute("title", 'PDF下载')
                //console.log(downloadPdf.getElementsByTagName('b')[0])
                downloadPdf.getElementsByTagName('b')[0].innerText = 'PDF下载'
                downloadPdf.setAttribute("href", downloadPdf.getAttribute("href") + '&dflag=pdfdown');
                pdf = downloadPdf.getAttribute("href");
            }
            // replace the html read with ris export
            if (operats.getElementsByClassName('icon-read').length || operats.getElementsByClassName('icon-html').length) {
                var exportBtnClassName = 'icon-read'
                if (operats.getElementsByClassName('icon-html').length) {
                    exportBtnClassName = 'icon-html'
                }
                var exportRis = operats.getElementsByClassName(exportBtnClassName)[0];
                exportRis.title = 'RIS';
                exportRis.removeAttribute('target');
                exportRis.removeAttribute('href');
                exportRis.onclick = function () {
                    // console.log('RIS Export: ' + title + ', ' + fileId + ', ' + dbName);
                    downloadRisOfPaper({
                        dbName: dbName,
                        fileId: fileId,
                        title: title,
                        // pdf: pdf
                    });
                }
                // RIS+
                if (pdf !== null && document.domain.indexOf('oversea') > -1) {
                    var exportRisPlus = exportRis.cloneNode(true);
                    exportRisPlus.title = 'RIS+';
                    exportRisPlus.onclick = function () {
                        downloadRisOfPaper({
                            dbName: dbName,
                            fileId: fileId,
                            title: title,
                            pdf: pdf
                        });
                    }
                    console.log(exportRisPlus);
                    operats.append(exportRisPlus);
                    operats.removeChild(operats.getElementsByClassName('icon-quote')[0]);
                    operats.insertBefore(exportRisPlus, exportRis);
                }
            }
            row.setAttribute('ris', true);
            paperList.push({
                dbName: dbName,
                fileId: fileId,
                title: title,
                pdf: pdf
            });
        }
    }
    console.log(paperList);
    setSearchCache(paperList);
}

function getCount(key) {
    return new Promise((resolve, reject) => {
        GM_xmlhttpRequest({
            method: "GET",
            url: "https://api.cuger.cn/count/" + key,
            headers: {
                'Connection': 'keep-alive',
                'Accept': 'text/plain, */*; q=0.01',
                'X-Requested-With': 'XMLHttpRequest',
                'User-Agent': navigator.userAgent,
                'Content-Type': 'application/x-www-form-urlencoded',
                'Sec-Fetch-Site': 'same-origin',
                'Sec-Fetch-Mode': 'cors'
            },
            onload: function (res) {
                if (res.status == 200) {
                    const data = JSON.parse(res.responseText);
                    console.log(`Key: ${data.data.key},Count: ${data.data.count}`);
                    resolve(res.responseText);
                } else {
                    console.log("HTTP Error when get pdf url from sci-hub. " + res.status);
                    resolve("");
                }
            }
        });
    })
}

function setSearchCache(paperList) {
    const key = 'PAPER-SAERCH-CACHE'
    const cacheTTL = 60 * 60 * 24; // 10 minutes
    if (paperList.length <= 0)
        return
    localStorage.setItem(key, JSON.stringify({
        papers: paperList,
        expAt: new Date().getTime() / 1000 + cacheTTL
    }));
}

function getSearchCache(fid = undefined) {
    const key = 'PAPER-SAERCH-CACHE'
    let cache = JSON.parse(localStorage.getItem(key));
    if (cache == null) {
        return null;
    }
    console.log(`search with fid: ${fid} in ${cache.papers}`)
    if (cache.expAt <= new Date().getTime() / 1000)
        return null;
    if (fid !== undefined) {
        let papers = cache.papers.filter((v, i) => {
            return v.fileId.toLowerCase() == fid.toLowerCase() ? 1 : 0;
        })
        console.log(papers);
        return papers.length > 0 ? papers[0] : null;
    } else {
        return cache.papers;
    }
}

function downloadRisOfPaper(paper) {
    if (paper.hasOwnProperty('pdf')) {
        getPdfUrl(paper.pdf)
            .then((pdfUrl) => {
                console.log(paper, pdfUrl);
                downloadByFilename(paper.fileId, paper.dbName, paper.title, 'EndNote', pdfUrl);
            })
            .catch((err) => {
                console.log('No pdf found.');
                downloadByFilename(paper.fileId, paper.dbName, paper.title, 'EndNote');
            })
    } else {
        downloadByFilename(paper.fileId, paper.dbName, paper.title, 'EndNote');
    }
}

// type can be EndNote or Refworks
function downloadByFilename(fileId, dbName, name, type = 'EndNote', pdfUrl = undefined) {
    getCount('CNKI-PDF-RIS-Helper');
    GM_xmlhttpRequest({
        method: "POST",
        url: "https://kns.cnki.net/dm/API/GetExport?uniplatform=NZKPT",
        data: "filename=" + dbName + "!" + fileId + "!1!0" + "&displaymode=" + type,
        anonymous: true,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36',
            'Referer': window.location.href
        },
        onload: function (res) {
            console.log(res);
            if (res.status == 200) {
                var res_json = JSON.parse(res.responseText);
                console.log(res_json);
                var text = res_json?.data?.[0]['value'][0];
                console.log(text);
                var a = document.createElement('a');
                text = text.replaceAll('<br>', '\r\n');
                text = text.replace(/<[^>\u4e00-\u9fa5]+>/g, "");
                // %A如果前面不是换行符,则添加换行
                text = text.replace(/(?<!\r\n)%A/g, "\r\n%A");
                // console.log(text);
                // add PDF URL if exist
                if (pdfUrl !== undefined) {
                    text += "%> " + pdfUrl;
                }
                console.log(text);
                a.href = 'data:application/x-EndNote-tagged; charset=utf-8,' + encodeURIComponent(text);
                //supported by chrome 14+ and firefox 20+
                a.download = name + '.ris';
                //needed for firefox
                document.getElementsByTagName('body')[0].appendChild(a);
                //supported by chrome 20+ and firefox 5+
                a.click();
            }
        }
    });
}

function getPdfUrl(url) {
    return new Promise((resolve, reject) => {
        GM_xmlhttpRequest({
            method: "GET",
            url: url,
            anonymous: false,
            headers: {
                'Connection': 'keep-alive',
                'Accept': 'text/plain, */*; q=0.01',
                'X-Requested-With': 'XMLHttpRequest',
                'Content-Type': 'application/x-www-form-urlencoded',
                'Origin': 'https://kns.cnki.net',
                'Sec-Fetch-Site': 'same-origin',
                'Sec-Fetch-Mode': 'cors'
            },
            onload: function (res) {
                if (res.status == 200) {
                    // var text = res.responseText;
                    console.log(res.finalUrl);
                    resolve(res.finalUrl)
                }
            },
            onerror: function (err) {
                reject(err)
            }
        });
    })
}