Skip to content

Instantly share code, notes, and snippets.

@hasbai
Created July 10, 2024 01:34
Show Gist options
  • Save hasbai/354af815d06f4d4c1ff89482b1ff34e9 to your computer and use it in GitHub Desktop.
Save hasbai/354af815d06f4d4c1ff89482b1ff34e9 to your computer and use it in GitHub Desktop.
从中国专利网获取专利数据,整理为表格并输出 http://epub.cnipa.gov.cn
const data = [...document.querySelectorAll("#result .item")].map((i) => {
const match = i.querySelector("h1").innerText.match(/\[(.+)\] (.+)/);
if (!match) {
console.error(i.querySelector("h1").innerText);
return;
}
return {
专利名称: match[2],
专利类型: match[1],
专利号: i.querySelector(".info dl:nth-child(3) dd").innerText,
申请日期: i
.querySelector(".info dl:nth-child(4) dd")
.innerText.replaceAll(".", "/"),
授权日期: i
.querySelector(".info dl:nth-child(2) dd")
.innerText.replaceAll(".", "/"),
申请人: i.querySelector(".info dl:nth-child(5) dd").innerText,
发明人: i.querySelector(".info dl:nth-child(6) dd").innerText,
};
});
console.table(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment