title: How can I Fetch data from a URL using javascript
body: <p>My requirement is to get the data on a page with URL example: <a href="https://www.blogger.com/about/" rel="nofollow noreferrer">https://www.blogger.com/about/</a>  I am able to do so using appscript code at compilation level in <strong>code.gs</strong> as shown below:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getPTtrack(linksArray){
    linksArray = `https://www.blogger.com/about/`;
    var ptTracknames = [];
    for(var sear in linksArray){
         var optoutlink= linksArray[sear].toString().search("Publish your passion");
     if(optoutlink!=-1){
    var x = linksArray[sear].replace("&gt;.","").replace("&lt;","").replace("&gt;","").toString();
    var page = UrlFetchApp.fetch(x).getContentText(); 
    var number = page.match(/&lt;b&gt;(.*)&lt;\/b&gt;/)[1];
    Logger.log(number);
    ptTracknames.push(number);
    }
    }
    console.log(ptTracknames);
    return ptTracknames;
  }</code></pre>
  </div>
  </div>
  </p>
  <p>This leads to delay in getting the output . To reduce loading time I would need to write the same code in <strong>javascript</strong> which can give output in run time. So if any one know which function can be used in javascript instead of the following function used in appscript.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>UrlFetchApp.fetch(x).getContentText(); </code></pre>
  </div>
  </div>
  </p>
  <p>I have come across various methods in stackoverflow which returns the value in JSON . I would like to get the value in text instead of a json value.</p>