Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/437.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将Google Rss提要转换为Yahoo Rss提要 将Google RSS提要转换为Yahoo RSS提要_Javascript_Php_Jquery_Html_Rss - Fatal编程技术网

Javascript 将Google Rss提要转换为Yahoo Rss提要 将Google RSS提要转换为Yahoo RSS提要

Javascript 将Google Rss提要转换为Yahoo Rss提要 将Google RSS提要转换为Yahoo RSS提要,javascript,php,jquery,html,rss,Javascript,Php,Jquery,Html,Rss,我发现自己经常使用feed(RSS、atom、JSON等),而且大多数时候都是将这些feed混合在一起用于一个站点,试图构建代码以使每个条件都正确无误只是一种痛苦,这是浪费时间、金钱和资源 有人能告诉我这段代码是否有语法错误,因为我没有运行任何输出: (function($){ var rss = function($el, url, options){ var s = this; s.el = $el; s.opts = $.extend({}, $.fn.feeds

我发现自己经常使用feed(RSS、atom、JSON等),而且大多数时候都是将这些feed混合在一起用于一个站点,试图构建代码以使每个条件都正确无误只是一种痛苦,这是浪费时间、金钱和资源

有人能告诉我这段代码是否有语法错误,因为我没有运行任何输出:

(function($){

var rss = function($el, url, options){
    var s = this;
    s.el = $el;
    s.opts = $.extend({}, $.fn.feeds.defaults, options );
    s.query = encodeURIComponent(url);
    s.load();
}

rss.prototype = {
    output : "",
    constructor : rss,
    delay: 50,
    timer : null,
    
    load : function( query ){
        var s = this,
            q = query || s.query,
            //(google api)
            //uri = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=" + s.opts.num + "&output=" + s.opts.output + '&q=' + q + '&callback=?';

             //(yahoo api)
              uri = "https://query.yahooapis.com/v1/yql?q=" + "select*from rss where url=" + q + '&format=' + s.opts.format + '&env=store://datatables.org/alltableswithkeys&callback=?';


if ( !s.timer ) {
            s.timer = setTimeout( function(){
                $.ajax({
                    url: uri,
                    dataType: 'json',
                    success: function(data) {
                        s.output = s.display( data );
                        s.timer = null;
                    }
                });
            }, s.delay );
        }
    },
    display : function (data) {
        var sHtml ="", s = this;
        if ( !data.responseData.feed ) {
            return "";
        }
        

当然它有语法错误,您没有关闭rss.prototype的curlybrace,也没有关闭外部闭包的大括号。请在将来使用理解Javascript的文本编辑器,例如
Atom
Visual Studio code
,它们将向您显示这些小错误。我只发送了一半的代码,我尝试了我能想到的所有查询组合,但似乎都不起作用。请告诉我。uri=“”+”从rss中选择*,其中url=“+q+”&格式=“+s.opts.format+”&环境=store://datatables.org/alltableswithkeys&callback=?';@故障工程师YQL的错误/响应是什么?我曾使用与您类似的方法查询过一个网站,但结果类似于
datatables not available
。。。你的问题。