产品比价脚本
您将如何构建价格比较脚本? 我知道亚马逊提供公共 API,但我看到了这两个网站 goodreads, bookdope< /a> 比较图书价格,从沃尔玛和其他不提供 API 的网站检索价格。 如何从没有 API 的网站获取价格?
我正在使用 C# 和 ASP.NET MVC。
How would you build a price comparison script? I know Amazon offers a public API, but I saw these two sites goodreads, bookdope which compare book prices, retrieve prices from Walmart and others websites that do not offer APIs. How do you get prices from sites that do not have an API?
I'm using C# and ASP.NET MVC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果该网站不提供 API,那么您需要执行所谓的屏幕抓取。 您获取页面的 HTML,然后让程序从中提取信息。
这可行,但要注意问题。
公司通常不喜欢你这样做。 如果他们希望您获取信息,他们会提供 API。 他们甚至可能检测到来自您特定位置的大量点击并阻止您。
最重要的是,该页面是为人们在浏览器中阅读而设计的。 他们可以随时更改它,您的申请可能会因此失败。
If the site does not offer an API then you need to do what is called screen scraping. You get the HTML of the page and you have your program extract the information out of it.
This works, but beware of the problems.
Companies ofen don't like you doing this. If they wanted you to get the information they'd have provided an API. They may even detect a high number of hits from your specific location and block you.
Above all else, the page is designed for a human to read in a browser. They can change it at any time and your application may fail as a result.