如何检索标题和网页摘要按计划? [英] How to retrieve title and summary of web page by programme?

查看:166
本文介绍了如何检索标题和网页摘要按计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像什么Digg的那样,当你提交一则新闻,标题和摘要的自动检索,该怎么办呢?

Like what digg does,when you submit a news,the title and summary is automatically retrieved,how to do it?

推荐答案

检索HTML并解析它。

Retrieve the HTML and parse it.

标题来自于<冠军> 标记。 摘要可以来自:

The title comes from the <title> tag. The summary can come from either:

  • 从内部的第一对夫妇的可见文本的一百个字符的&LT;身体GT; 标记
  • 的说明&LT;元&GT; 标记
  • The first couple of hundred characters of visible text from inside the <body> tag.
  • The description <meta> tag.

如果网站提供的RSS源(你会发现在&LT;链接相对=交替式=申请/ RSS + XML&GT; 从替代标签)使用的列装的信息。

If the site provides an RSS feed (which you'll find in the <link rel="alternate" type="application/rss+xml"> tag) use the fielded information from that instead.

有没有一个正确的回答了这个问题。可能有其他可能的策略。但是,这应该让你开始。

There is no one right answer to this question. There are probably other strategies possible. But this should get you started.

这篇关于如何检索标题和网页摘要按计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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