c# - 从外部 URL 中提取文本

标签 c# asp.net parsing

我正在制作像 Facebook 一样的分享链接功能。目前我正在解析元标记以获取关键字、描述等,但如何解析这些类型的页面 http://en.wikipedia.org/wiki/Wikipedia该页面没有元描述,但 facebook 仍获取以下描述: 维基百科(/ˌwɪkɪˈpiːdi.ə/或/ˌwɪkiˈpiːdi.ə/WIK-i-PEE-dee-ə)是一个免费的、[3]基于网络的协作式多语言百科全书项目,由非营利性维基媒体基金会支持。它的 1700 万篇文章(超过 340 万篇英文)是由世界各地的志愿者合作撰写的。

如果页面上没有找到元描述标签,如何提取此类描述。

最佳答案

看起来他们以相同的方式生成描述 Bing可能很难轻松地重新创建:

How does Bing generate a description of my Web site?

The way you design your Web page content has the greatest impact on your Web page description. As MSNBot crawls your Web site, it analyzes the content on indexed Web pages and generates keywords to associate with each Web page. MSNBot extracts Web page content that is most relevant to the keywords, and constructs the Web site description that appears in search results. The Web page content is typically sentence segments that contain keywords or information in the description tag. The Web page title and URL are also extracted and appear in the search results.

If you change the contents of a Web page, your Web page description might change the next time the Bing index is updated. To influence your Web site description, make sure that your Web pages effectively deliver the information you want in the search results. Webmaster Center recommends the following strategies when you design your content:

* Place descriptive content near the top of each Web page.
* Make sure that each Web page has a clear topic and purpose.
* Create unique <title> tag content for each page.
* Add a Web site description <meta> tag to describe the purpose of

each page on your site. For example:

> <META NAME="Description"
> CONTENT="Sample text - describe your

http://www.bing.com/toolbox/support/faqs.aspx

一种选择是点击 Bing 并尝试从那里获取描述。

关于c# - 从外部 URL 中提取文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4286550/

相关文章:

c# - 如何比较两个对象之间的属性

c# - 在 C# 中将文本框输入限制为数字

c# - .NetCore 和 SoapCore 如何进行身份验证

c# - 无法将土耳其语字符从文本文件读取到字符串数组

asp.net - gridview asp.net 将鼠标悬停在 TR 上查找在服务器端代码上单击了哪一行

c# - 创建引用 ActionFilters、HTTPContext、HTTPException 等的 .Net Standard 库

linux - 从shell中的json中提取特定元素的值

python - 在 Python 中提取 URL

javascript - 如何从 JavaScript 中的 URL 中提取主机?

c# - 使用 gridview 中的复选框获取删除的行数