256 Kilobytes

Extracting Emails from HTML with Google Sheets: Get Contact Information in Bulk for Guest Posts, (lmao) 404 Replacement, and Other Outreach

Articles in Web Scraping, Data Analysis | By August R. Garcia

Published

What a nice trick.

508 views, 0 RAMs, and 0 comments

What a nice trick.

Code

function get_raw_html(url) {
  // The code below logs the HTML code of the Google home page.
  var response = UrlFetchApp.fetch(url);
  if (!response) return "No Response Found";
  
  var text     = response.getContentText();
  if (!text) return "No Text Found";
  
  var emails   = extract_emails(text);
  if (!emails) return "No Emails Found";
  
  var result   = emails.join(); 

  return result; 
}

function extract_emails( text ) {
//  var regex = /(?:^|\s|$)([a-zA-Z0-9.\+_-]+@[a-zA-Z0-9._-]+)/gi;
  var regex = /(?:^|\s|$)([a-zA-Z0-9.\+_-]+@[a-zA-Z0-9._-]+[a-zA-Z0-9_-]{1})/gi;
  var matches = [];
  var match;
  while (match = regex.exec(text)) { matches.push(match[1]); }
  return matches;
}

Resources Mentioned

Download more RAM. 🐏 ⨉ 0Posted by August R. Garcia 1 year ago 🕓 Posted at 25 May, 2019 17:20 PM PDT

Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account