{"id":21352026,"url":"https://github.com/chinobing/rssinn","last_synced_at":"2025-07-12T20:32:03.713Z","repository":{"id":40466858,"uuid":"476792183","full_name":"chinobing/RSSinn","owner":"chinobing","description":"RSSinn is a RSS generator powered by FastAPI.     RSSinn 是一个基于FastAPI的RSS生成器.","archived":true,"fork":false,"pushed_at":"2022-11-01T01:24:54.000Z","size":270,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T04:41:38.850Z","etag":null,"topics":["fastapi","python","rss-generator","rsshub","rssinn"],"latest_commit_sha":null,"homepage":"https://www.rssinn.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinobing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-01T16:22:21.000Z","updated_at":"2024-10-28T02:23:24.000Z","dependencies_parsed_at":"2023-01-20T17:00:51.170Z","dependency_job_id":null,"html_url":"https://github.com/chinobing/RSSinn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chinobing/RSSinn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinobing%2FRSSinn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinobing%2FRSSinn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinobing%2FRSSinn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinobing%2FRSSinn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinobing","download_url":"https://codeload.github.com/chinobing/RSSinn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinobing%2FRSSinn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265049061,"owners_count":23703458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","python","rss-generator","rsshub","rssinn"],"created_at":"2024-11-22T03:12:19.237Z","updated_at":"2025-07-12T20:32:03.411Z","avatar_url":"https://github.com/chinobing.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 介绍\r\nRSSinn是一个基于python FastAPI 的RSS生成器。 利用了FastAPI 自动生成交互式文档、支持 asyncio等特点， 减少了手动创建文档的工作量。\r\n\r\n## 功能说明\r\n### fetch\r\n用于解释url，返回\r\n1. 带Selector的html原始数据，可用于XPath或者CSS\r\n2. json\r\n\r\n**参数**：\r\n1. proxy: {\"proxy_server\":\"\", \"proxy_username\":\"\", \"proxy_password\":\"\"} \r\n2. fetch_js: True or False #利用playwright获取js加载的网页内容\r\n3. cache_enabled:  True or False #是否cache缓存\r\n\r\n```python\r\n#引入\r\nfrom models.utils import fetch\r\n\r\n#使用\r\nresponse = await fetch(url)\r\n\r\n```\r\n\r\n\r\n\r\n### RSS过滤\r\nrssinn集成了内容过滤功能\r\n\r\n1. **inculde_keywords**：包含指定的关键字；\r\n2. **exclude_keywords**：不含指定关键字。\r\n\r\n引入方式\r\n```python\r\nfrom fastapi import APIRouter, Depends\r\nfrom models.utils import filter_keywords, filter_content\r\n```\r\n使用方式， 具体可参考`feeds/toscrape.py/`中的`quotes_with_filter`例子\r\n```python\r\ndemo = APIRouter()\r\n\r\n@demo.get(\"/demo_with_filter/\",\r\n              summary=\"获取带指定关键字的所有quotes\",\r\n              description=\"`inculde_keywords`：包含指定的关键字；`exclude_keywords`：不含指定关键字；\")\r\nasync def demo_with_filter(filters=Depends(filter_keywords)):\r\n    #获取feed代码\r\n    ......\r\n    \r\n    items_list = []\r\n    for _item in items:\r\n        item = Item(title=_item['author'], author=_item['author'], description=_item['description'])\r\n         # 在item项中添加下面代码即可即可\r\n        _filter = filter_content(item, filters)\r\n        if _filter:\r\n            items_list.append(item)\r\n\r\n    feed_data = {\r\n        'title': 'toscrape with content filter',\r\n        'link': 'toscrape.com',\r\n        'description': \"\",\r\n        'item': items_list,\r\n    }\r\n    feed = RSSFeed(**feed_data)\r\n    return RSSResponse(feed)\r\n\r\n```\r\n路由: `https://localhost:28085/demo?include_keywords=[]\u0026exclude_keywords=[]`\r\n\r\n### proxy\r\n这里提供了两种proxy方式\r\n- 第一种， 直接在`setting.yaml`中填写相应的proxy\r\n- 第二种， 在feed脚本中单独添加, 利用了[CharlesPikachu freeproxy](https://github.com/CharlesPikachu/freeproxy) 库\r\n```python\r\n#引入\r\nfrom models.proxy_checker import ProxyChecker\r\n\r\n#feed的目标地址\r\nurl=“http://example.com”\r\n\r\n#返回proxy url\r\nproxy = ProxyChecker.proxy(url)\r\nresponse = await fetch(url,  proxy={\"proxy_server\": proxy})\r\n\r\n```\r\n\r\n### upptime\r\n\u003e Upptime (https://upptime.js.org) is the open-source uptime monitor and status page, powered entirely by GitHub Actions, https://github.com/upptime/upptime\r\n\r\n请在`setting.yaml`中填写相应的`github username` 和 `repo`\r\n\r\n**demo**： https://www.rssinn.com/upptime\r\n\r\n### redis or in-memory cache\r\n由于过度实时加载feeds会导致服务器资源紧张， 这里引入了cache\r\n\r\n请在`setting.yaml`中填写相应的cache时间(秒)和方式（redis or in-memory)\r\n\r\n**使用方式一：cache整个route返回的结果**\r\n\r\n直接引入`@cached()`即可\r\n```python\r\nfrom models.decorator import cached\r\n\r\ndemo = APIRouter()\r\n\r\n@demo.get(\"/example/\")\r\n@cached() \r\nasync def example():\r\n    pass\r\n```\r\n\r\n**使用方式二：cache fetch返回的原始html**\r\n\r\n在`fetch`中添加`cache_enabled=True)`即可\r\n```python\r\nraw_html = await fetch(url, cache_enabled=True)\r\n```\r\n这样做的目的是：模拟增量式抓取和数据更新，防止被目标网站封禁\r\n\r\n# 贡献RSS Feed方法\r\n1. 首先fork这个repository\r\n2. 在`feeds`文件夹中创建新的`py`脚本，并将对应的APIRoute路由的名称添加到`__init__.py`， 将对应的APIRoute路由的名称同时添加到根目录的`routes.py`\r\n4. 提pr\r\n\r\n\r\n# 部署|Deployment\r\n## 直接部署\r\n下载 `RSSinn` 的源码\r\n```\r\ngit clone https://github.com/chinobing/RSSinn.git\r\ncd RSSinn\r\n```\r\n安装依赖库\r\n```\r\npip install -r requirements.txt\r\n\r\n国内的运行：\r\npip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple\r\n```\r\n运行playwright\r\n```commandline\r\nplaywright install\r\n```\r\n\r\n运行项目\r\n```\r\nuvicorn run:app --host 0.0.0.0 --port 28085\r\n```\r\n\r\n注：\r\n1. **requires python 3.8**\r\n## PDM部署（Linux)\r\n\u003e [PDM (Python Development Manager)](https://pdm.fming.dev/) 是一个新的 Python 项目管理器，类似Pipenv 和 Poetry。\r\n\r\n下载 `RSSinn` 的源码\r\n```\r\ngit clone https://github.com/chinobing/RSSinn.git\r\ncd RSSinn\r\n```\r\n安装PDM\r\n```\r\npip install --user pdm\r\n```\r\n执行` pdm init `初始化项目，并填写项目信息， 最后生成` pyproject.toml` 配置文件\r\n- 是否要上传 PyPI\r\n- 依赖的 Python 版本\r\n- License 类型\r\n- 作者信息\r\n- 邮箱信息\r\n- 是否导入`requirements.txt`\r\n\r\n将`pdm命令`加入path\r\n```\r\nexport PATH=/root/.local/bin:$PATH\r\n```\r\n\r\n安装/更新项目依赖库\r\n```\r\npdm update\r\n```\r\n运行playwright\r\n```commandline\r\npdm run playwright install\r\n```\r\n后台运行项目命令\r\n```commandline\r\nnohup pdm run uvicorn run:app --host 0.0.0.0 --port 28085 \u003e log.txt 2\u003e\u00261 \u0026\r\n```\r\n\r\n调试debug命令\r\n```commandline\r\npdm run uvicorn run:app --host 0.0.0.0 --port 28085 --reload --debug\r\n```\r\n\r\n关闭进程命令\r\n```commandline\r\nfuser -n tcp -k 28085\r\n```\r\n\r\n注：\r\n1. **requires  Python 3.8**\r\n\r\n\r\n## Docker 部署\r\n制作镜像文件\r\n```\r\ndocker build -t \"rssinn\" .\r\n```\r\n\r\n创建docker容器 \r\n\r\n```\r\ndocker run -dit -p 28085:28085 rssinn\r\n```\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinobing%2Frssinn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinobing%2Frssinn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinobing%2Frssinn/lists"}