Advertisement
turist_ua

jublia contacts parser

Jul 4th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     da_people = [];
  2.     da_nodes = document.getElementsByClassName('list_full_desk');
  3.  
  4. function httpGetAsync(id, callback) {
  5.     var xmlHttp = new XMLHttpRequest();
  6.     xmlHttp.onreadystatechange = function() {
  7.         if (xmlHttp.readyState == 4 && xmlHttp.status == 200) callback(xmlHttp.responseText);
  8.     };
  9.  
  10.     xmlHttp.open("GET", 'https://jublia.com/e/WGES2017/backend/TweetPitch.php?id_attendee=' + id, true); // true for asynchronous
  11.     xmlHttp.send(null);
  12. }
  13.  
  14. for(let i = 0; i < da_nodes.length; i++){
  15.     if (da_nodes[i].id) {
  16.         httpGetAsync(da_nodes[i].id, (row) => {
  17.             let json = JSON.parse(row).quoteData,
  18.                 location = json.my_preference_matches.find(item => item.attribute == "Location"),
  19.                 locationData = location && location.list[0].value,
  20.                 person = [json.fullName, json.position, json.companyName, json.companyUrl, locationData];
  21.  
  22.             console.log(person);
  23.             da_people.push(person.join(';'));
  24.         });
  25.     }
  26. }
  27.  
  28. console.log('Processed rows: ', da_nodes.length);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement