guitarplayer616

Javascript getDataFromTable

Jan 24th, 2021 (edited)
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //https://www.digminecraft.com/lists/item_id_list_pc_1_12.php
  2. //inspect element
  3.  
  4. var table = document.querySelector("#minecraft_items > tbody")
  5. var str = ""
  6. for (var i = 1, row; row = table.rows[i]; i++) {
  7.     var label_name = row.cells[1].innerText.split("\n")
  8.     var label = label_name[0]
  9.     var name = label_name[1].replace(/[()]/g, '')
  10.     var id = row.cells[2].innerText
  11.     var data = row.cells[3].innerText
  12.     str = str + "add_to_dict(dict, \"" + name +"\", \"" + label + "\", " + id +", " + data + ")\n"
  13. }
  14. console.log(str)
  15.  
Add Comment
Please, Sign In to add comment