mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-04 02:26:11 +08:00
📝 试试zenuml (
This commit is contained in:
parent
cdc8de9619
commit
3773c77864
@ -30,19 +30,19 @@ class WeiboSite(Site):
|
|||||||
|
|
||||||
```python {1}
|
```python {1}
|
||||||
class WeiboSite(CookieSite):
|
class WeiboSite(CookieSite):
|
||||||
name = "weibo.com"
|
name = "weibo.com"
|
||||||
schedule_type = "interval"
|
schedule_type = "interval"
|
||||||
schedule_setting = {"seconds": 3}
|
schedule_setting = {"seconds": 3}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 为你的 Site 类添加一个`client_mgr`属性
|
2. 为你的 Site 类添加一个`client_mgr`属性
|
||||||
|
|
||||||
```python {5}
|
```python {5}
|
||||||
class WeiboSite(CookieSite):
|
class WeiboSite(CookieSite):
|
||||||
name = "weibo.com"
|
name = "weibo.com"
|
||||||
schedule_type = "interval"
|
schedule_type = "interval"
|
||||||
schedule_setting = {"seconds": 3}
|
schedule_setting = {"seconds": 3}
|
||||||
client_mgr = create_cookie_client_manager(name)
|
client_mgr = create_cookie_client_manager(name)
|
||||||
```
|
```
|
||||||
|
|
||||||
至此,你的站点就可以使用 Cookie 了!
|
至此,你的站点就可以使用 Cookie 了!
|
||||||
@ -60,36 +60,28 @@ class WeiboSite(CookieSite):
|
|||||||
|
|
||||||
目前整体的调度逻辑是:
|
目前整体的调度逻辑是:
|
||||||
|
|
||||||
```mermaid
|
|
||||||
graph TD
|
|
||||||
A[获取订阅] --> B[获取订阅的Cookie]
|
|
||||||
B --> C[验证Cookie]
|
|
||||||
C --> D[返回Cookie]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
|
|
||||||
zenuml
|
zenuml
|
||||||
title 一份快递是如何投递的
|
title Cookie调度逻辑
|
||||||
Scheduler #661ae6
|
Scheduler #661ae6
|
||||||
Platform #2b2d30
|
Platform #2b2d30
|
||||||
ClientManager #FFEBE6
|
CookieClientManager #FFEBE6
|
||||||
DB #f26522
|
DB #f26522
|
||||||
Internet #0747A6
|
Internet #0747A6
|
||||||
@Starter(Scheduler)
|
@Starter(Scheduler)
|
||||||
Scheduler.exec_fetch{
|
Scheduler.exec_fetch{
|
||||||
Post = Platform.do_fetch_new_post(SubUnit) {
|
Post = Platform.do_fetch_new_post(SubUnit) {
|
||||||
Platform.get_sub_list(Target){
|
Platform.get_sub_list(Target){
|
||||||
client = ClientManager.get_client(Target){
|
client = CookieClientManager.get_client(Target){
|
||||||
choose(){
|
cookie = CookieClientManager._choose_cookie(Target) {
|
||||||
cookies = DB.get_cookies()
|
cookies = DB.get_cookies()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
client = CookieClientManager._assemble_client(Target, cookie)
|
||||||
}
|
}
|
||||||
res = Internet.client.get(Target)
|
res = Internet.client.get(Target)
|
||||||
ClientManager.submit_status(){
|
CookieClientManager._response_hook(){
|
||||||
DB.update()
|
DB.update_cookie()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1013
pnpm-lock.yaml
generated
1013
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user