2017-01-15 42 views
4

我用谷歌訂閱API尋找RSS特殊的關鍵字或網站,現在這個API棄用的飼料,所以我需要另一種方法查找網站的RSS,我谷歌,但我找不到什麼好的辦法..Google feed api已棄用,我如何才能找到rss feed的網站?

查找RSS解析HTML網站對我來說並不好,因爲我想從它的任何子域名中找到所有的RSS。

例如,在過去,當使用谷歌API飼料我給ieee.org,並得到所有的RSS,如:

http://www.ieee.org/rss/index.html?feedId=News_Release

http://spectrum.ieee.org/rss/fulltext

http://spectrum.ieee.org/rss/blog/automaton/fulltext

和....

那麼,有沒有任何API或服務,我可以找到所有的RSS網站的飼料?

回答

0

您可以使用rss2json API獲取與Google Feed API相同的Feed數據。

var url = "http://www.espncricinfo.com/rss/content/feeds/news/8.xml"; //feed url 
var xhr = createCORSRequest("GET","https://api.rss2json.com/v1/api.json?rss_url="+url); 
if (!xhr) { 
    throw new Error('CORS not supported'); 
} else { 
    xhr.send(); 
} 
xhr.onreadystatechange = function() { 
    if (xhr.readyState==4 && xhr.status==200) { 
     var responseText = xhr.responseText; 
     var result = JSON.parse(responseText); 
     console.log(result); 
    } 
} 
function createCORSRequest(method, url) { 
    var xhr = new XMLHttpRequest(); 
    if ("withCredentials" in xhr) { 
     xhr.open(method, url, true); 
    } else if (typeof XDomainRequest != "undefined") { 
     xhr = new XDomainRequest(); 
     xhr.open(method, url); 
    } else { 
     xhr = null; 
    } 
    return xhr; 
} 
+0

坦爲盡力幫助我,但我需要的RSS網址取景器不是RSS到JSON方法.. !!請再讀一遍我的問題! –