为没有 API 的网站创建 YQL
我计划为没有基于 XML/JSON 的 API 的站点创建一个 YQL 打开表。我计划使用 HTML 抓取从网站获取数据并将其返回给 YQL。这可能吗?开放表的性质是否相似?
I plan to create a YQL open table for a site which does not have an XML/JSON based API. I plan to use HTML scrapping to get data from the site and return it to YQL. Is this possible and is any of the Open Tables similar in nature?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题 1:是的,有可能
如果这样做,您可能会经常使用自己数据表的
部分。您可以在其中编写 JavaScript,在将数据发送回客户端之前在服务器端处理数据。我无法比文档更好地解释如何将服务器端 javascript 与 YQL 结合使用,而且这在很大程度上取决于您的用例的具体情况。因此,让我向您指出文档的相关部分: YQL 文档 - 执行元素
问题 2: 示例
您可能会发现这个有用的示例,也来自文档。
https://developer.yahoo .com/yql/guide/yql-execute-examples.html#yql-execute-example-css-selector
另外,您应该会对这样的表格感兴趣:
http://github.com/spullara/yql-tables /blob/master/search/search.imageweb.xml
一旦完成,请告诉我你的实验进展如何:)
Question 1: Yes, it is possible
If doing this you will probably use the
<execute>
part of your own datatable quite a bit. In there your can write javascript that processes the data on server side, before it is sent back to your client.I cannot explain better how to use server side javascript with YQL than the documentation can and also it depends a lot on the specifics of your use case. Therefore let me point you to the relevant part of the documentation: YQL Documentation - execute element
Question 2: Examples
One example that you might find useful is this one, also from the docs.
https://developer.yahoo.com/yql/guide/yql-execute-examples.html#yql-execute-example-css-selector
Additionally tables like this should be interesting for you:
http://github.com/spullara/yql-tables/blob/master/search/search.imageweb.xml
Let me know how your experiment went, once it is done :)