diff --git a/app.py b/app.py index 768efb7..0d98efe 100644 --- a/app.py +++ b/app.py @@ -131,16 +131,15 @@ async def thread_view(tid): async def forum_view(): fname = request.args['kw'] pn = int(request.args.get('pn') or 1) - sort = int(request.args.get('sort') or 0) + sort = int(request.args.get('sort') or 5) async with aiotieba.Client() as tieba: forum_info, threads = await asyncio.gather(awaitify(find_tieba_info)(fname), - tieba.get_threads(fname, rn=50, pn=pn, sort=sort)) + tieba.get_threads(fname, pn=pn, sort=sort)) if threads.page.current_page > threads.page.total_page or pn < 1: return await render_template('error.html', msg = \ f'请求越界,本贴吧共有 { threads.page.total_page } 页' f'而您查询了第 { threads.page.current_page} 页') - return await render_template('bar.html', info=forum_info, threads=threads, sort=sort) @app.route('/home/main') diff --git a/requirements.txt b/requirements.txt index d6ac9b9..84ebd8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ aioflask==0.4.0 flask==2.1.3 -aiotieba==3.4.5 +aiotieba==3.5.0 Flask-Caching beautifulsoup4 requests diff --git a/templates/bar.html b/templates/bar.html index ae3e047..9d70aa7 100644 --- a/templates/bar.html +++ b/templates/bar.html @@ -23,12 +23,13 @@