Advertisement
x94fujo6

抓資料

Oct 7th, 2021 (edited)
1,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * 復製本文
  3.  * 到 https://wiki.biligame.com/blhx/%E5%AE%9E%E8%A3%85%E6%97%A5%E6%9C%9F
  4.  * F12 貼上 按enter
  5.  */
  6. let
  7.     extractData = (ele) => {
  8.         let _tmp = [],
  9.             nor = (node) => node.textContent.trim().replace(/[\s·]/mg, "");
  10.         ele.querySelector("tbody")
  11.             .children
  12.             .forEach(node => {
  13.                 _tmp.push({
  14.                     sn: nor(node.children[0]),
  15.                     name: nor(node.children[1]),
  16.                     date: nor(node.children[2]),
  17.                 });
  18.             });
  19.         return _tmp;
  20.     },
  21.     list = [];
  22. document.querySelector("div[class=row]")
  23.     .children
  24.     .forEach(ele => list = list.concat(extractData(ele)));
  25. console.log(JSON.stringify(list));
  26. console.log(list);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement