2017-07-21 73 views
0

我有一個https網站,我需要創建一個rss提要。我可以成功獲取http站點的rss提要,但我一直未能成功訪問https站點。我用谷歌,雅虎和其他許多閱讀rss,但一直不成功。我需要使用jQuery或js或jsp/java來閱讀rss feed。任何幫助將不勝感激。https提要閱讀器。 js jquery

//this is just for test 
 

 
YUI().use('yql', function(Y){ 
 
    var query = 'select * from rss(0,3) where url = "some https site"' 
 
    var q = Y.YQL(query, function(r){ 
 
     //r now contains the result of the YQL Query as a JSON 
 
     var feedmarkup = '<p>' 
 
     var feed = r.query.results.item // get feed as array of entries 
 
     for (var i=0; i<feed.length; i++){ 
 
      feedmarkup += '<a href="' + feed[i].link + '">' 
 
      feedmarkup += feed[i].title + '</a><br />' 
 
      feedmarkup += feed[i].description + '</p>' 
 
     } 
 
     document.getElementById('qznews').innerHTML = feedmarkup 
 
    }) 
 
})
//this is just for the test 
 
<script src="http://yui.yahooapis.com/3.18.1/build/yui/yui-min.js"></script> 
 
<div id="qznews"></div>

回答

0

夥計們,我能夠使用這個職位從堆棧溢出來解決我上面的問題:https://github.com/sdepold/jquery-rss 感謝任何人花時間/精力放在我的問題。

<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> 
 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script> 
 
    <script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script> 
 

 
    <script src="jquery.rss.min.js"></script> 
 
    <script> 
 
    jQuery(function($) { 
 
     $("#rss-feeds").rss("add any https feed link will work perfectly", 
 
     { 
 
     entryTemplate:'<li><a href="{url}">[{author}@{date}] {title}</a><br/>{teaserImage}{shortBodyPlain}</li>' 
 
     }) 
 
    }) 
 
    </script>
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    
 
    
 
</head> 
 

 
<body> 
 
    <div id="rss-feeds"></div> 
 
</body> 
 

 
</html>