Fra*_*nes 68
您可以通过查看主页(或博客)的来源找到它.寻找一条如下所示的行:
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://example.org/rss" />
Run Code Online (Sandbox Code Playgroud)
href值将是RSS所在的位置.
小智 14
有多种方法可以获取网站的RSS源.
您可以做的是获取网站的页面源并搜索此链接标记 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/")
Run Code Online (Sandbox Code Playgroud)
使用.py扩展名保存此文件并运行它.它将为您提供该网站的RSS订阅源URL.
Google还提供API来查找网站的RSS源.请在此处找到它们:Google Feed API
| 归档时间: |
|
| 查看次数: |
89289 次 |
| 最近记录: |