View difference between Paste ID: bDNKN4Yd and 6NDng6wN
SHOW: | | - or go back to the newest paste.
1-
	da_people = [];
1+
let da_companies = [];
2-
	da_nodes = document.getElementsByClassName('list_full_desk');
2+
3
function httpGetAsync(url, callback) {
4-
function httpGetAsync(id, callback) {
4+
    let xmlHttp = new XMLHttpRequest();
5-
    var xmlHttp = new XMLHttpRequest();
5+
6
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) callback(xmlHttp.responseText);
7
    };
8
9
    xmlHttp.open("GET", url, true); // true for asynchronous
10-
    xmlHttp.open("GET", 'https://jublia.com/e/WGES2017/backend/TweetPitch.php?id_attendee=' + id, true); // true for asynchronous
10+
11
}
12
13
for(let i=1; i <=6; i++){
14-
for(let i = 0; i < da_nodes.length; i++){
14+
    let url = 'https://www.icelondon.uk.com/2019-exhibitors?page=' + i + '&filters.STATUS=,Enhanced%20-%20Featured,Featured,Enhanced,Basic#/'
15-
    if (da_nodes[i].id) {
15+
    httpGetAsync(url, (page) => {
16-
        httpGetAsync(da_nodes[i].id, (row) => {
16+
        let el = document.createElement( 'html' );
17-
            let json = JSON.parse(row).quoteData,
17+
        el.innerHTML = page;
18-
                location = json.my_preference_matches.find(item => item.attribute == "Location"),
18+
19-
                locationData = location && location.list[0].value,
19+
        let companies = el.getElementsByClassName('m-exhibitors-list__items__item__body__name__link');
20-
                person = [json.fullName, json.position, json.companyName, json.companyUrl, locationData];
20+
//console.log(companies);
21
        for(let j = 0; j < companies.length; j++){
22-
            console.log(person);
22+
            let c = {
23-
            da_people.push(person.join(';'));
23+
                name: companies[j].text.trim(),
24-
        });
24+
                url: companies[j].href
25-
    }
25+
            };
26
27
            httpGetAsync(c.url, (cpage) => {
28-
console.log('Processed rows: ', da_nodes.length);
28+
                let el2 = document.createElement('html');
29
30
                el2.innerHTML = cpage;
31
32
                c.email = el2.getElementsByClassName('m-exhibitor-entry__item__body__contacts__additional__button__mail')[0].children[0].href.replace('mailto:', '');
33
				c.linkedin = ''; 
34
				let social = el2.getElementsByClassName('m-exhibitor-entry__item__body__contacts__additional__social')[0].children; 
35
				for (let item of social) {
36
					var link = item.getElementsByTagName('a')[0].href; link.indexOf('linkedin') > 0 && (c.linkedin = link)
37
				}
38
                c.website = el2.getElementsByClassName('m-exhibitor-entry__item__body__contacts__additional__button__website')[0].children[0].href;
39
				c.country = el2.getElementsByClassName('m-exhibitor-entry__item__body__contacts__address')[0].innerHTML.split('<br>');
40
				c.country = c.country[c.country.length-1].trim();
41
            });
42
            da_companies.push(c);
43
        }
44
    });
45
}
46
47
////////////////////
48
let resp = [];
49
50
da_companies.forEach(c => {
51
    resp.push([c.name, c.url, c.email, c.linkedin, c.website, c.country].join(';'));
52
});
53
54
55
////////////////////
56
console.log(resp.join('\n'));