getTitle.js 293 B

12345678910111213
  1. /*
  2. getTitle.js
  3. Get the title of the page
  4. */
  5. requirelib("http");
  6. var pageContent = http.get(url);
  7. var matches = pageContent.match(/<title>(.*?)<\/title>/);
  8. if (matches == null || matches.length == 0){
  9. sendResp("");
  10. }else{
  11. sendResp(matches[0].replace(/(<([^>]+)>)/gi, ""));
  12. }