FetchRSS.com API的简单接口
项目描述
fetchrss-api: FetchRSS API的Python客户端库
安装
pip install fetchrss-api
直接从GitHub上的Git仓库
pip install git+https://github.com/Impacto-jor/fetchrss-api.git
或
git clone https://github.com/Impacto-jor/fetchrss-api.git
cd fetchrss-api
python setup.py install
在Python 3.7.0上进行了测试(您可以通过安装dataclasses
包使用3.6版)。
用法
通过示例学习
from fetchrss import FetchRSS
# Instantiate the object
api = FetchRSS(access_token="<super secret>")
# Create a new feed using URL only
feed = api.feed_create(url="https://some-url/")
print(f"Feed created: {feed}")
# Create a new feed using all parameters
feed = api.feed_create(
url="https://some-url/",
news_selector="<news selector>",
title_selector="<title selector>",
content_selector="<content selector>",
pic_selector="[optional picture selector]",
date_selector="[optional date selector]",
author_selector="[optional author selector]",
link_selector="[optional link selector]",
pic_src_param="[optional picture source parameter]",
date_format_param="[optional date format parameter]",
)
print(f"Feed created: {feed}")
# List all available feeds
for feed in api.feeds():
print(feed)
# Get RSS entries for a specific feed
for entry in api.rss(feed):
print(entry)