Last active
February 27, 2019 16:52
-
-
Save junaidkbr/570286e0dd7a4e3ec120688660c769c7 to your computer and use it in GitHub Desktop.
Scrape doctor information from ada.org
This file contains hidden or 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
/* | |
This script will scrape and display the doctors (available on a search page) information in the browser console. | |
Example search results page: https://findadentist.ada.org/search-results?address=22060 | |
How to use: | |
1. Search for doctors on https://findadentist.ada.org | |
2. When you get a list of doctors for your search criteria, open browser developer console | |
How to open console in Firefox: https://developer.mozilla.org/en-US/docs/Tools/Browser_Console#Opening_the_Browser_Console | |
How to open Console in Chrome: https://developers.google.com/web/tools/chrome-devtools/console/ | |
3. Copy and paste the following code snippet in the Developer console | |
4. Hit return/enter button to execute the code | |
5. All doctors' information (on the page) will be printed to the console, so you can copy and paste it easily. | |
*/ | |
$('.dentist-list__content .dentist-list__item').each(function(i, doc) { | |
var $doc = $(doc); | |
var name = $doc.find('h3 a').text().trim(); | |
var $email = $doc.find('p.email'); | |
var email = ''; | |
if ($email.length) { | |
email = $email.find('a').attr('href').replace('mailto:', ''); | |
email = email.substring(0, email.indexOf('?')); | |
} | |
var phone = $doc.find('p.phone a').attr('href').replace('tel:', ''); | |
var address = $doc.find('p.address').text().trim(); | |
console.log(`${name}\n${email}\n${phone}\n${address}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment