Menu

Getting the contact email from 500 company websites: hidden addresses, junk matches and dead domains
📰

Getting the contact email from 500 company websites: hidden addresses, junk matches and dead domains

DEV Community: javascript·SpellzCode·2 days ago
#4qmv5m8y
#devtojavascript#devto#dev#email#const
Reading 0:00
15s threshold

"Find the contact email on each of these websites" sounds like one regex. In practice a naive scraper gets a third of the emails wrong or misses them. This post walks through the four problems that cause most of the misses, with code for each. Disclosure: SpellzCode, the brand behind this account, sells a tool that does all of this (linked at the end), but the techniques below stand on their own.

1. The email is not on the home page

Most companies put their address on a Contact, About, Team or Imprint page. Look at the home page's links and open the few most likely ones, including other languages:

const CONTACT_WORDS = / contact | kontakt | about | om - oss | team | imprint | impressum | mentions - legales | contacto | contatti | yhteystiedot / i ;

function likelyContactPages ( html , baseUrl , max = 4 ) { const links = [ . . . html .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.