换了新论坛,我的rss又挂了一个
Tofloor
poster avatar
137******33
deepin
2020-11-09 00:48
Author

我也知道这种需求实在是太小众了

所以只是想上来说一句而已

不得不说,rss这东西真的越来越少了。多好的东西啊,就被信息流给取代了


Reply Favorite View the author
All Replies
冷风
deepin
2020-11-09 00:55
#1

你订阅的东西真多

Reply View the author
大泽IO
deepin
2020-11-09 03:24
#2
我居然不知道老深度论坛支持rss!

话说我好像在B站看过你

Reply View the author
大泽IO
deepin
2020-11-09 03:46
#3

API已经被我挖出来了,开干

全部:https://bbs.deepin.org/api/v1/thread/index?order=updated_at&limit=20&where=&offset=0

热门:https://bbs.deepin.org/api/v1/thread/index?order=updated_at&limit=20&where=hot_value&offset=0

精华:https://bbs.deepin.org/api/v1/thread/index?order=updated_at&limit=20&where=is_digest&offset=0

Reply View the author
taffy
deepin
2020-11-09 04:02
#4

这id这头像,b站阿婆?经常看的

Reply View the author
大泽IO
deepin
2020-11-09 16:58
#5

昨天晚上忙到12点,终于搞定!

先装上pytz、PyRSS2Gen、Quart这仨工具(用pip3安装)

然后把下面这堆代码,存盘为deepin_rss.py,开终端跑起来

最后rss阅读器连接http://127.0.0.1:60000即可

#!/bin/env python3
import pytz
import datetime
import PyRSS2Gen
import requests
from quart import Quart, abort

app = Quart(__name__)
tz = pytz.timezone('Asia/Shanghai')
utc = pytz.utc


def timeconvert(time):
time = str(time).split('+')[0].split('T')
date = time[0].split('-')
time = time[1].split(':')
time = datetime.datetime(int(date[0]), int(date[1]), int(
date[2]), int(time[0]), int(time[1]), int(time[2]))
return time.astimezone(utc)


def buildtitle(item):
title = '【' + item['type']['name'] + '】' + item['subject']
if item['top'] == 1:
title = '【置顶】' + title
return title


def buildde*ion(item):
return f"{item['forum']['name']} {item['user']['nickname']} · {item['updated_at_desc']} 最后回复{item['last_date_desc']} {item['views_cnt']}浏览 {item['posts_cnt']}评论"


@app.route('/favicon.ico')
async def favicon():
return ""


@app.route('/')
@app.route('/')
@app.route('//')
async def root(whare = '',limit = '100'):
url = f'https://bbs.deepin.org/api/v1/thread/index?order=updated_at&limit={limit}&where={whare}&offset=0'
headers = {'user-agent': 'daze/DRC/1.0.0'}
deepin = requests.get(url=url, headers=headers)
if deepin.status_code != 200:
abort(deepin.status_code)
else:
deepin = deepin.json()
deepin = deepin['ThreadIndex']
items = []
for item in deepin:
url = 'https://bbs.deepin.org/post/' + str(item['id'])
items.append(PyRSS2Gen.RSSItem(title=buildtitle(item),
link=url,
de*ion=buildde*ion(item),
author=item['user']['nickname'],
guid=PyRSS2Gen.Guid(url),
pubDate=timeconvert(item['updated_at'])))
for last in deepin:
if last['top'] != 1:
last = timeconvert(last['updated_at'])
break
rss = PyRSS2Gen.RSS2(
title="深度论坛",
link="https://bbs.deepin.org/index",
de*ion="由DRC提供的适用于Deepin新版论坛的RSS订阅源",
lastBuildDate=last,
items=items,
generator='DRC 1.0.0',
docs="https://appstore.zdatek.top/daze/DRC")
return rss.to_xml("utf-8"), 200, [('content-type', 'application/xml; charset=utf-8')]


if __name__ == "__main__":
print('DRC 1.0.0 Starting....')
app.run(port=60000)




Reply View the author
Shinglee
deepin
2020-11-09 18:38
#6

都不知道rss是干嘛的,以前装Windows,上来就把rss给禁用了[怀疑]

Reply View the author
zerofancy
deepin
2020-11-11 18:38
#7

同样需要。尤其对于论坛来说,rss能很快过滤出自己感兴趣的内容,而不至于淹没在信息流中。


@dz_123 的方案是个解决方案,但还是希望官方出一个订阅api,就不用本地跑个脚本了。

Reply View the author
大泽IO
deepin
2020-12-29 20:21
#8
zerofancy

同样需要。尤其对于论坛来说,rss能很快过滤出自己感兴趣的内容,而不至于淹没在信息流中。


@dz_123 的方案是个解决方案,但还是希望官方出一个订阅api,就不用本地跑个脚本了。

现在我已经把它做成一个docker容器了

介绍帖:

https://bbs.deepin.org/post/208829

Reply View the author