如何获取按给定 XPATH 排序的 YQL 的 JSON 结果
我正在尝试抓取一个网站。
我使用 XPATH 进行了 YQL 查询,查询文章的标题、日期和正文。
select * from html where url="mywebsite.com/myarticle" and xpath="headlineXpath | DateXpath | BodyXpath"
现在 xml 中的结果是标题、日期,然后是正文,这就是我正在寻找的。
但是当我得到 json 格式的结果时,我以另一种顺序得到它标题,正文然后日期 我的问题:如何根据给定 XPATHS 的顺序获取 json 中的结果?
感谢您的帮助
I am trying to crawl a website.
I have made my YQL query with XPATh for headline, Date, then Body of the article.
select * from html where url="mywebsite.com/myarticle" and xpath="headlineXpath | DateXpath | BodyXpath"
now the result in xml is headline, date, then body and this is what i am looking for.
but when i get the result in json format, i get it in another order headline, body then date
my question: how can i get the result in json according to the order of the given XPATHS?
thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过:
而不是使用*?我不太了解 YQL,所以我可能对参数不太了解,但想法是使用显式选择而不是通配符来指定字段的顺序。
Did you try:
instead of using *? I don't know much YQL so I may be off on the arguments, but the idea is to specify the order of fields using explicit selection instead of the wildcard.