Skip to content

Commit

Permalink
update for 2024.10 version
Browse files Browse the repository at this point in the history
  • Loading branch information
taisukef committed Oct 18, 2024
1 parent ee8b9d5 commit ad790a7
Show file tree
Hide file tree
Showing 7 changed files with 809 additions and 1,572 deletions.
1,523 changes: 778 additions & 745 deletions saj-memberlist.csv

Large diffs are not rendered by default.

745 changes: 0 additions & 745 deletions saj-memberlist0.csv

This file was deleted.

48 changes: 0 additions & 48 deletions src/fetchList.js

This file was deleted.

11 changes: 0 additions & 11 deletions src/makeCSV.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/parseList.js

This file was deleted.

1 change: 0 additions & 1 deletion src/scrape.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
await import("./scrapeList.js");
await import("./makeCSV.js");
39 changes: 31 additions & 8 deletions src/scrapeList.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import { fetchOrLoad, HTMLParser, CSV, nextTag, prevTag, table2json, table2csv, sleep } from "https://code4fukui.github.io/scrapeutil/scrapeutil.js";
import { fetchList } from "./fetchList.js";

const fn = "../saj-memberlist0.csv";
const url = "https://archive.saj.or.jp/memberlist/all.html";
const fn = "../saj-memberlist.csv";

const html = await fetchOrLoad(url);
const dom = HTMLParser.parse(html);
const list = [];
for (let i = 0;; i += 20) {
const url = "https://www.saj.or.jp/M10/M1001AL/corporate_name/asc/" + i;
//const url = "https://www.saj.or.jp/M10/M1001AL";

const link = dom.querySelector(".content_main iframe").getAttribute("src");
console.log(link);
const html = await fetchOrLoad(url);
const dom = HTMLParser.parse(html);

const list = await fetchList(link);
const dls = dom.querySelectorAll(".table_list li dl");
if (dls.length <= 1) break;
for (let j = 1; j < dls.length; j++) {
const dl = dls[j];
const dtdd = dl.querySelectorAll("dt,dd");
const item = {};
for (let i = 0; i < dtdd.length; i += 2) {
const name = dtdd[i].text.trim();
const val = dtdd[i + 1].text.trim();
//console.log(name, val);
item[name] = val;
}
list.push({
name: item.法人名,
pref: item.都道府県,
url: item.法人URL,
type: item.会員区分,
});
console.log(list.length)
}
await sleep(200);
}

console.log(list, list.length)
await Deno.writeTextFile(fn, CSV.stringify(list));

0 comments on commit ad790a7

Please sign in to comment.