Skip to content

Commit 3d0bc8b

Browse files
authored
v2.5.27: 更新网页端收藏夹的正则表达式;更新文档 (#319)
1 parent 37e1d67 commit 3d0bc8b

14 files changed

+91
-9
lines changed

assets/docs/mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ plugins:
4040
python:
4141
paths: [ '../../src/' ]
4242
options:
43+
summary:
44+
functions: true
45+
preload_modules:
46+
- common
4347
docstring_style: sphinx
4448

4549

assets/docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ mkdocs
22
mkdocstrings[python]
33
markdown-include
44
mkdocs-material
5+
commonX

assets/docs/sources/api/client.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# client
22

33
::: jmcomic.jm_client_impl
4-
4+
options:
5+
members:
6+
- JmHtmlClient
7+
- JmApiClient
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# command-line
2+
3+
::: jmcomic.cl
4+
options:
5+
members:
6+
- JmcomicUI

assets/docs/sources/api/config.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# config
22

3-
::: jmcomic.jm_config.JmModuleConfig
3+
::: jmcomic.jm_config
4+
options:
5+
members:
6+
- JmMagicConstants
7+
- JmModuleConfig
8+
- default_jm_logging
9+

assets/docs/sources/api/download.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# download
22

33
::: jmcomic.api
4-
4+
options:
5+
members:
6+
- download_album
7+
- download_photo
8+
- create_option
9+
- create_option_by_env
10+
- create_option_by_file
11+
- create_option_by_str

assets/docs/sources/api/entity.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# entity
22

3-
::: jmcomic.jm_entity
3+
::: jmcomic.jm_entity
4+
options:
5+
inherited_members: true
6+
members:
7+
- JmAlbumDetail
8+
- JmPhotoDetail
9+
- JmImageDetail
10+
- JmPageContent
11+
- JmSearchPage

assets/docs/sources/api/option.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# option
22

3-
::: jmcomic.jm_option.JmOption
3+
::: jmcomic.jm_option
4+
options:
5+
members:
6+
- DirRule
7+
- JmOption

assets/docs/sources/api/plugin.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# plugin
22

3-
::: jmcomic.jm_plugin
3+
::: jmcomic.jm_plugin
4+
options:
5+
filters:
6+
- Plugin$

assets/docs/sources/api/toolkit.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# toolkit
2+
3+
::: jmcomic.jm_toolkit
4+
options:
5+
inherited_members: true
6+
members:
7+
- JmcomicText
8+
- PatternTool
9+
- JmPageTool
10+
- JmImageTool
11+
- JmCryptoTool

assets/docs/sources/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
## 入门
1515

1616
- [快速上手(GitHub README)](https://github.com/hect0x7/JMComic-Crawler-Python/tree/master?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B)
17-
- [常用类和方法演示](tutorial/0_common_usage)
17+
- [常用类和方法演示](tutorial/0_common_usage.md)
1818
- [option配置以及插件写法](./option_file_syntax.md)
1919

2020

assets/docs/sources/tutorial/0_common_usage.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,35 @@ for aid, atitle, tag_list in page.iter_id_title_tag(): # 使用page的iter_id_t
146146
download_album(aid_list, option)
147147
```
148148

149+
## 获取收藏夹
150+
151+
可参考discussions: https://github.com/hect0x7/JMComic-Crawler-Python/discussions/235
152+
153+
```python
154+
from jmcomic import *
155+
156+
option = JmOption.default()
157+
client = option.new_jm_client()
158+
client.login('用户名', '密码') # 也可以使用login插件/配置cookies
159+
160+
# 遍历全部收藏的所有页
161+
for page in cl.favorite_folder_gen(): # 如果你只想获取特定收藏夹,需要添加folder_id参数
162+
# 遍历每页结果
163+
for aid, atitle in page.iter_id_title():
164+
# aid: 本子的album_id
165+
# atitle: 本子的名称
166+
print(aid)
167+
# 打印当前帐号的所有收藏夹信息
168+
for folder_id, folder_name in page.iter_folder_id_name():
169+
print(f'收藏夹id: {folder_id}, 收藏夹名称: {folder_name}')
170+
171+
# 获取特定收藏夹的单页,使用favorite_folder方法
172+
page = cl.favorite_folder(page=1,
173+
order_by=JmMagicConstants.ORDER_BY_LATEST,
174+
folder_id='0' # 收藏夹id
175+
)
176+
```
177+
149178
## 分类 / 排行榜
150179

151180
禁漫的分类是一个和搜索有些类似的功能。

src/jmcomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 被依赖方 <--- 使用方
33
# config <--- entity <--- toolkit <--- client <--- option <--- downloader
44

5-
__version__ = '2.5.26'
5+
__version__ = '2.5.27'
66

77
from .api import *
88
from .jm_plugin import *

src/jmcomic/jm_toolkit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class JmPageTool:
397397
# 收藏页面的本子结果
398398
pattern_html_favorite_content = compile(
399399
r'<div id="favorites_album_[^>]*?>[\s\S]*?'
400-
r'<a href="/album/(\d+)/">[\s\S]*?'
400+
r'<a href="/album/(\d+)/[^"]*">[\s\S]*?'
401401
r'<div class="video-title title-truncate">([^<]*?)'
402402
r'</div>'
403403
)

0 commit comments

Comments
 (0)