diff --git a/app.py b/app.py index 0e5d252..728899a 100644 --- a/app.py +++ b/app.py @@ -139,9 +139,15 @@ async def forum_view(): if only_use_native_api: forum_info, threads = await asyncio.gather(tieba.get_forum_detail(fname), tieba.get_threads(fname, pn=pn, sort=sort)) - forum_info = { 'avatar': 'a6efce1b9d16fdfa6291460ab98f8c5495ee7b51.jpg', - 'topic': forum_info.post_num, 'thread': forum_info.post_num, - 'member': forum_info.member_num, 'desc': '贴吧描述暂不可用', 'name': forum_info.fname } + if hasattr(forum_info, 'slogan'): + forum_info = { 'avatar': extract_image_name(forum_info.origin_avatar), + 'topic': forum_info.post_num, 'thread': forum_info.post_num, + 'member': forum_info.member_num, 'desc': forum_info.slogan, + 'name': forum_info.fname } + else: + forum_info = { 'avatar': 'a6efce1b9d16fdfa6291460ab98f8c5495ee7b51.jpg', + 'topic': forum_info.post_num, 'thread': forum_info.post_num, + 'member': forum_info.member_num, 'desc': '贴吧描述暂不可用', 'name': forum_info.fname } else: forum_info, threads = await asyncio.gather(awaitify(find_tieba_info)(fname), tieba.get_threads(fname, pn=pn, sort=sort))