我正在制作一个使用 Android WebView 的应用程序。此应用程序显示加载的 URL 的页面标题和页面描述。作为示例,我使用以下网址
http://in.news.yahoo.com/ca-chief-slams-racist-comments-over-fawad-ahmeds-071749766.html?.tsrc=yahoo
获取页面标题很容易
public void onPageFinished (WebView view, String url) {
String title = view.getTitle();
}
如果您在 Chrome 中查看上述 url 的源代码,则该标题取自
<title>CA chief slams `racist` comments over Fawad Ahmed's `beer-branded kit` refusal - Yahoo! News India</title>
现在,我需要获取元名称“描述”,以显示页面描述,如下所示
<meta name="description" lang="en-IN" content="'CA chief slams `racist` comments over Fawad Ahmed's `beer-branded kit` refusal' on Yahoo! News India. Islamabad, Sept 5 (ANI): Cricket Australia (CA) chief James Sutherland has slammed 'racist comments' aimed at Pakistan-born Australian leg-spinner Fawad Ahmed following his refusal to wear a kit displaying the logo of beer brand VB due to 'religious reasons'."/>
Android Web 视图没有从元标记“描述”中获取描述的 API。
如何从文档元素中获取元标记?