【问题标题】:Trouble getting a YQL table working无法使 YQL 表正常工作
【发布时间】:2012-02-13 22:15:56
【问题描述】:

所以我尝试使用http://www.teamliquid.net/video/streams/?filter=live&xml=1 的 API 设置 YQL 表,但遇到了一些问题。

这是我的表定义:

<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
    <meta>
        <author>TL.net</author>
        <description>TL.net's streams</description>
        <documentationURL>none</documentationURL>
        <sampleQuery>select * from {table}</sampleQuery>
    </meta>
    <bindings>
        <select itemPath="streamlist" produces="XML">
            <urls>
                <url>http://www.teamliquid.net/video/streams/?xml=1</url>
            </urls>         
            <inputs>
                <key id="filter" type="xs:string" paramType="query" />
            </inputs>
        </select>
     </bindings>
</table>

运行 use "store://q5awkFLmEqteFVOTUJbQ6h" as tl; select * from tl where filter="live" 会产生以下错误:

<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
    yahoo:count="0" yahoo:created="2012-02-13T22:14:48Z" yahoo:lang="en-US">
    <diagnostics>
        <publiclyCallable>true</publiclyCallable>
        <url execution-start-time="1" execution-stop-time="33"
            execution-time="32" proxy="DEFAULT"><![CDATA[store://q5awkFLmEqteFVOTUJbQ6h]]></url>
        <url execution-start-time="35" execution-stop-time="232"
            execution-time="197" http-status-code="406"
            http-status-message="Not Acceptable" proxy="DEFAULT"><![CDATA[http://www.teamliquid.net/video/streams/?xml=1&filter=live]]></url>
        <user-time>232</user-time>
        <service-time>258</service-time>
        <build-version>25247</build-version>
    </diagnostics> 
    <results/>
</query>

我真的不知道为什么它不起作用。

【问题讨论】:

    标签: yql


    【解决方案1】:

    在调试语句中,您可以看到 YQL 正在从您的源 URL 读取:http://www.teamliquid.net/video/streams/?xml=1&amp;filter=live,但正在接收返回 HTTP 406 Not Acceptable 错误消息。

    HTTP 406 旨在涵盖服务器无法以任何请求(接受标头)格式响应的情况。我不知道这在这种情况下如何应用,但 teamliquid.net 来源提到了以下内容:

    gzip 编码是必需的,请同时发送一个有效的用户代理,其中包含您的应用程序/站点的名称和联系信息。此页面和 XML 每五分钟更新一次,请不要比每五分钟更频繁地进行轮询,否则您可能会面临被 IP 封禁的风险。如有任何问题,请PM R1CH。

    我怀疑这是两件事之一:

    1. YQL 服务器未请求 gzip 或压缩格式的数据
    2. teamliquid.net 服务器正在阻止 YQL

    【讨论】:

      猜你喜欢
      • 2017-12-20
      • 2016-12-01
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-20
      • 2016-03-11
      • 2017-05-23
      相关资源
      最近更新 更多