专利列表下载

下载企查查、爱企查、天眼查的专利列表,需要是显示出来的部分,如果有多页需要手动点,然后多次下载。

目前为 2023-06-04 提交的版本。查看 最新版本

// ==UserScript==
// @name         专利列表下载
// @namespace    http://tampermonkey.net/
// @version      2.6
// @description  下载企查查、爱企查、天眼查的专利列表,需要是显示出来的部分,如果有多页需要手动点,然后多次下载。
// @author       angeljhon
// @match        *://www.qcc.com/*/*
// @match        *://www.tianyancha.com/*/*
// @match        *://aiqicha.baidu.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
	'use strict';

	// Create a new button element
	const button = document.createElement('button');
	button.innerText = '下载';

	// Change the button style
	button.style.backgroundColor = 'black';
	button.style.color = 'white';
	button.style.position = 'fixed';
	button.style.bottom = '20px';
	button.style.right = '5px';
	button.style.zIndex = '9999';
    button.style.width ='60px';
    button.style.height = '30px';

	// Add the button to the page
	document.body.appendChild(button);

	// Add a click event listener to the button
	button.addEventListener('click', () => {
		//window.location.href='<%=basePath%>pmb/excelShowInfo.do';
		//获取表格
		var dl_name="专利列表.xls";
		var c_name="";
        var exportFileContent;
		try{
			var e_s=document.querySelector("#zhuanlilist")
            //exportFileContent =e_s.getElementsByTagName("table")[0].outerHTML;
            exportFileContent =e_s.querySelector("table.ntable").outerHTML;
            // exportFileContent = document.querySelector("div.tablist:nth-child(1) > div:nth-child(2) > table:nth-child(1)").outerHTML;
			c_name =document.querySelector("h1.copy-value").textContent;
            dl_name=c_name+"_企查查_专利列表.xls";
			//alert(c_name);
		}catch(err){
			try{
				var targetText="专利名称";
                var ts_e= document.getElementsByClassName('table-wrap');
                ww1:{
                    for(var i=0;i<ts_e.length;i++){
                        var zhuangli_es=ts_e[i].getElementsByTagName('td');
                        for(var ii=0;ii<zhuangli_es.length;ii++){
                            var element = zhuangli_es[ii];
                            if (element.textContent === targetText){
                                exportFileContent=ts_e[i].outerHTML;
                                break ww1;
                            }
                        }
                    }
                }
                //exportFileContent = document.querySelector(".table-wrap").outerHTML;
                c_name =document.querySelector(".index_company-name__LqKlo").textContent;
				dl_name=c_name+"_天眼查_专利列表.xls";
				//alert("你好,我是一个警告框!");
			}catch(err){
				exportFileContent = document.querySelector(".certRecord-patent-table").outerHTML;
                c_name =document.querySelector(".name").textContent;
				dl_name=c_name+"_爱企查_专利列表.xls";
			}
		}
        if(exportFileContent != undefined){
            //使用Blob
            var blob = new Blob([exportFileContent], {type: "text/plain;charset=utf-8"});//解决中文乱码问题
            blob = new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});
            //设置链接
            var link = window.URL.createObjectURL(blob);
            var a = document.createElement("a");
            //a.download = "专利列表.xls"; 
            a.download = dl_name;
            a.href = link; 
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
        }else{
            alert("下载失败!");
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址