Google Apps Script does not support HTTPS connections with proxy servers.

156 views
Skip to first unread message

Avito Bot

unread,
Nov 9, 2023, 12:13:07 PM11/9/23
to Google Apps Script Community
Please tell me how to parse the site https://parserposter.ru / using a proxy?

function makeHttpRequestThroughProxy() {
  var proxyUrl = 'https://193.233.40.139:24531'; // Replace with your proxy server URL
  var targetUrl = 'https://parserposter.ru/'; // Replace with your target URL

  var headers = {
    'Content-Type': 'application/json'
  };
 
  var options = {
    method: 'GET',
    headers: headers,
    mode: 'cors',
    redirect: 'follow',
    follow: 'manual',
    muteHttpExceptions: true,
    // Add the login and password for the proxy server
    headers: {
      'Proxy-Authorization': 'Basic ' + Utilities.base64Encode('ledye:2V8bpZ')
    }
  };
 
  var response = UrlFetchApp.fetch(proxyUrl + '?url=' + encodeURIComponent(targetUrl), options);
  var content = response.getContentText();
  var title = content.match(/<title>(.*?)<\/title>/i)[1];
 
  SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("A1").setValue(title);
}

Avito Bot

unread,
Nov 15, 2023, 6:04:52 AM11/15/23
to Google Apps Script Community
 Поддерживается?

четверг, 9 ноября 2023 г. в 20:13:07 UTC+3, Avito Bot:
Reply all
Reply to author
Forward
0 new messages