mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-01 21:26:08 +08:00
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/ - 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页 - 每个扩展点一页,侧边栏由页面表生成 - 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
30 lines
1022 B
Markdown
30 lines
1022 B
Markdown
# Search Site (search_site)
|
|
|
|
Adds a site to the search box. `@provider(points.SEARCH_SITE, id=...)` returns a `SearchSite`. The `id` is the site name.
|
|
|
|
```python
|
|
from ab_sdk.search import SearchSite
|
|
|
|
@provider(points.SEARCH_SITE, id="my-site")
|
|
def site(self):
|
|
return SearchSite(url="https://example.com/rss?q=%s", parser="tmdb")
|
|
```
|
|
|
|
- `url` must have exactly one `%s`. AB replaces it with the keyword (several words are joined with `+`).
|
|
- `parser` selects the metadata source that completes the search results: `mikan` or `tmdb`.
|
|
- A site with the same name that the user set in the search settings has priority over the site from a plugin.
|
|
- If the site needs a login, add a Cookie with the [`http.request` hook](/en/dev/plugins/points/http-request).
|
|
|
|
## Tests
|
|
|
|
```python
|
|
from ab_sdk.testing import SearchSiteContract, create_plugin
|
|
|
|
class TestSite(SearchSiteContract):
|
|
def create(self):
|
|
plugin, _ = create_plugin(MyPlugin)
|
|
return plugin.site()
|
|
```
|
|
|
|
Example: `examples/plugins/custom-rss-site`.
|