-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为B站动态API建立model,转发动态放入repost字段 #507
Conversation
✅ Deploy Preview for nonebot-bison ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/pyd-compat #507 +/- ##
==================================================
+ Coverage 83.50% 83.66% +0.15%
==================================================
Files 78 78
Lines 3565 3636 +71
==================================================
+ Hits 2977 3042 +65
- Misses 588 594 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
nonebot_bison/platform/bilibili.py
Outdated
if in_repost and raw_origin: | ||
url = f"https://t.bilibili.com/{raw_origin.dynamic_id_str}" | ||
else: | ||
url = f"https://t.bilibili.com/{raw_post.desc.dynamic_id_str}" | ||
text: str = card_content["item"]["description"] | ||
pic: list[str] = [img["img_src"] for img in card_content["item"]["pictures"]] | ||
return ParsedPost(text, pic, url, repost_owner) | ||
case 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么不像原来那样分为 _get_info 和 parse 两个函数了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为原来两个函数里都是按category分支看起来很啰嗦,感觉不如合成一个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是这里写了4便if repose,看起来还是可以简化的那种
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
def extract_id(name: str):
if in_repost and raw_origin:
return getattr(raw_origin, name)
return getattr(raw_post.desc, name)
match self._do_get_category(raw_post.desc.type):
case 1:
# 一般动态
url = f"https://t.bilibili.com/{extract_id('dynamic_id_str')}"
...
这样呢(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
行吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
稍微再改了一点
ea5e76e
to
81f252a
Compare
先合并前置的 #512 |
No description provided.