如何find特定网站的RSS提要?

如何find特定网站的RSS提要? 是否有任何特定的方式来find它?

您可以通过查看主页(或博客)的来源find它。 找一条如下所示的行:

<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://example.org/rss" /> 

href值将是RSS所在的位置。

有多种方式可以获得网站的RSS提要。

你可以做的是获得一个网站的页面源,并search这个链接标签的type="application/rss+xml"

这将包含该网站的RSS源,如果有的话。

这里是一个简单的python程序,将打印任何网站的RSS提要,如果有的话。

 import requests from bs4 import BeautifulSoup def get_rss_feed(website_url): if website_url is None: print("URL should not be null") else: source_code = requests.get(website_url) plain_text = source_code.text soup = BeautifulSoup(plain_text) for link in soup.find_all("link", {"type" : "application/rss+xml"}): href = link.get('href') print("RSS feed for " + website_url + "is -->" + str(href)) get_rss_feed("http://www.extremetech.com/") 

使用.py扩展名保存此文件并运行它。 它会给你的网站rss饲料url。

Google还提供API来查找网站的RSS源。 请在这里find它们: Google Feed API

您需要循环访问您网站上的所有url,然后find包含“rss”的url。

上面的方法可能在某些情况下不起作用,如果href标签中的url看起来像feed.xml ,那么在这种情况下,你需要遍历所有包含href rss的标签,然后从href属性parsingurl。

如果你想通过浏览器做到这一点,请按CTRL + U查看源代码,然后按CTRL + F打开查找窗口,然后只需键入rssRSS源url应该立即出现。

我需要findRSS提要的网站。 使用Visual Studio(VB)我能够做到这一点。 以下代码只是一个片段。 它死循环完成后,但它确实find任何网站rss页面的ref。 这就是我所需要的,所以我从来没有完成过。 但是它为我工作。

导入System.Net导入System.IO

Dim request As WebRequest request = WebRequest.Create(“ http:// www。[site] ”)

  Dim response As WebResponse = request.GetResponse() Dim responseStream As Stream = response.GetResponseStream() Dim reader As New StreamReader(responseStream) Dim line As String = reader.ReadLine() Dim intPos As Integer Do line = reader.ReadLine() intPos = line.IndexOf("/rss") If intPos > 0 Then MessageBox.Show(line + " " + intPos.ToString) End If Loop While Not line Is Nothing 

….