简体   繁体   English

从网站ASP.NET MVC3中提取元数据

[英]Extract metadata from website ASP.NET MVC3

I have been going round in circles trying to extract meta tag information from external websites. 我一直在试图从外部网站提取meta tag信息。 I started of with a XML approach but due to tags link doctype etc, my application kept throwing errors. 我开始使用XML方法,但由于标签链接doctype等,我的应用程序不断抛出错误。

I am now taking a HttpResponse approach, I know how to get the website back and stored in a variable as a string but 我现在正在采用HttpResponse方法,我知道如何将网站恢复并作为字符串存储在变量中但是

I can't figure out how to extract a substring from the content in the meta tags? 我无法弄清楚如何从元标记中的内容中提取子字符串?

I have been searching for a solution to this problem for days. 我好几天都在寻找这个问题的解决方案。 Thanks in advance! 提前致谢!

使用HTML Agility Pack下载,解析和查询外部HTML。

I never tried it with meta tags but for HTML documents is the Html Agility Pack a good solution. 我从未尝试使用meta标签,但对于HTML文档而言, Html Agility Pack是一个很好的解决方案。 For some examples see this blog post . 有些例子,请参阅此博文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM