在Apps脚本中从URL中检索页面标题 [英] Retrieve page title from URL in Apps Script

查看:103
本文介绍了在Apps脚本中从URL中检索页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从我已经使用Apps Script的网址检索页面标题。


$ b

  var url = r.getValue (); 
var title = magically_retrieve_title(url);
setTitle(title)

我该怎么做?

$ b $如果你想在'普通'URL获得页面的标题,那么你可以使用UrlFetchApp.fetch(url)获得页面的内容。 ),然后解析标题标签。



如果不是,请提供更多信息 - 此处是什么?你在使用哪种网址?

i need to retrieve the page title from an URL i already have using Apps Script.

  var url= r.getValue();
  var title= magically_retrieve_title(url);
  setTitle(title)

How can i do that?

解决方案

If you want to get the title of the page at a 'normal' URL, then you can get the contents of the page using UrlFetchApp.fetch(url) and then parse the title tag.

If not, then please provide more information- what is r here ? What sort of URL are you working with ?

这篇关于在Apps脚本中从URL中检索页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆