Guest User

Untitled

a guest
Oct 29th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. console.clear();
  2.  
  3. let headers = ['amount', 'name', 'link'];
  4.  
  5. let tags = document.getElementsByClassName('clouds_xsmall');
  6.  
  7. let data = [];
  8. for (let item of tags) {
  9.     let link = item.firstChild;
  10.  
  11.     let href = link.href;
  12.     let title = link.title;
  13.     let amount = parseInt(title.match(/\d+/)[0]);
  14.     let text = link.innerHTML;
  15.  
  16.     data.push({
  17.         amount,
  18.         name: text,
  19.         link: href,
  20.     });
  21. }
  22.  
  23. data.sort((a, b) => {
  24.     return b.amount - a.amount;
  25. })
  26.  
  27. console.table(data, headers)
  28.  
Advertisement
Add Comment
Please, Sign In to add comment