Last active
September 2, 2020 07:15
-
-
Save i-anshuman/4167702f7f358fd1933afe128ab96549 to your computer and use it in GitHub Desktop.
Data Scraping From Web Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function IndiaMart() { | |
let numbers = []; | |
let nodes = document.querySelectorAll('.pns_h'); | |
for(let i = 0; i < nodes.length; i++) { | |
numbers.push(nodes[i].innerHTML); | |
} | |
return numbers; | |
} | |
console.log(IndiaMart()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function classToDigit(classname) { | |
switch (classname) { | |
case 'icon-acb': | |
return '0'; | |
case 'icon-yz': | |
return '1'; | |
case 'icon-wx': | |
return '2'; | |
case 'icon-vu': | |
return '3'; | |
case 'icon-ts': | |
return '4'; | |
case 'icon-rq': | |
return '5'; | |
case 'icon-po': | |
return '6'; | |
case 'icon-nm': | |
return '7'; | |
case 'icon-lk': | |
return '8'; | |
case 'icon-ji': | |
return '9'; | |
case 'icon-dc': | |
return '+'; | |
case 'icon-ba': | |
return '-'; | |
case 'icon-fe': | |
return '('; | |
case 'icon-hg': | |
return ')'; | |
} | |
} | |
function justDial() { | |
let contacts = document.querySelectorAll('.contact-info'); | |
let numbers = []; | |
for (let i = 0; i < contacts.length; i++) { | |
let number = ""; | |
let rawNumber = contacts[i].querySelectorAll('.mobilesv'); | |
for (let j = 0; j < rawNumber.length; j++) { | |
number += classToDigit(rawNumber[j].classList[1]); | |
} | |
numbers.push(number); | |
} | |
return numbers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment