从Apps脚本中的URL检索页面标题

Cho*_*eat 1 google-apps-script

我需要使用Apps脚本从我已经拥有的URL中检索页面标题.

  var url= r.getValue();
  var title= magically_retrieve_title(url);
  setTitle(title)
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

Sri*_*rik 5

如果您想在"普通"网址上获取网页标题,则可以使用UrlFetchApp.fetch(网址)获取网页内容,然后解析标题标记.

如果没有,那么请提供更多信息 - 这里有什么?您使用的是哪种URL?