-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetchInfo_sample.js
60 lines (51 loc) · 1.55 KB
/
fetchInfo_sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { fetchInfo, fetchInfoSummary, fetchInfoBasic } from "./fetchInfo.js";
// 2020年までしか入ってない?
const cidjig = "3011101042092";
const cidsharp = "6120001005484"; // 特許情報 22644件
const cidnintendo = "1130001011420";
const cidkirishima = "8120001003239";
//const cid = cidsharp;
//const cid = cidjig;
const cid = cidnintendo;
//const cid = cidkirishima;
const infob = await fetchInfoBasic(cid);
console.log("info basic", infob);
Deno.exit(0);
const info = await fetchInfo(cid);
console.log("info", info);
const infos = await fetchInfoSummary(cid);
console.log("info summary", infos);
Deno.exit(0);
//const res = await fetchInfo(cid, "temp/");
const res = JSON.parse(await Deno.readTextFile("temp/" + cid + ".json"));
//console.log(res);
const patent = []; // 特許
const design = []; // 意匠
const trademark = []; // 商標
const addUnique = (array, s) => {
if (array.indexOf(s) == -1) {
array.push(s);
}
};
res.patent.sort((a, b) => b.application_date.localeCompare(a.application_date));
for (const d of res.patent) {
switch (d.patent_type) {
case "特許": {
addUnique(patent, d.title);
break;
}
case "意匠": {
addUnique(design, d.title);
break;
}
case "商標": {
addUnique(trademark, d.title);
break;
}
default: {
throw "unknown patent_type";
}
}
console.log(d.application_date, d.title);
}
//console.log(patent.join(", "), design.join(", "), trademark.join(", "));