"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 .…